0

i always work with branches. But sometimes, a particular changeset is in conflict with an another branch's changeset.

  • Changeset 1 added new code
  • changeset 2 from branch 2 is based on the old code. (more changeset in branch 2)

When I pull in changeset 2 it complains about conflict with changeset 1 which is already on master.

How can I fix changeset 2 such that when we accept PR or git rebase locally we don't have to go through manual fix?

git checkout commit-hash
fix commit
git commit
git rebase -i HEAD~2

now what? i have already pushed previous changes to my repo and there are many more changesets in the original branch (branch 2)

user423455
  • 735
  • 2
  • 9
  • 18
  • If I'm reading your question right, you could use rebasing, as described in [this section of the Git Book](http://git-scm.com/book/en/Git-Branching-Rebasing). – bdesham Jun 20 '13 at 17:27
  • maybe it is duplicate. maybe not. see my edit please. I am basically stuck what to do after rebase. – user423455 Jun 20 '13 at 17:49
  • Perhaps you could update the question with a visual (`git log --graph --all -20`) description of the current state of your repository so that we have a better idea of exactly what you're asking. – Ajedi32 Jun 20 '13 at 18:26

1 Answers1

0

I'm not sure I understood your question properly, but it looks like you want to rebase your branch 2 to either master or branch 1, before merging it into master.

Gabriele Petronella
  • 102,227
  • 20
  • 204
  • 227