git commits&branches mess up

Mathieu Bridon bochecha at daitauha.fr
Fri Nov 6 13:35:22 UTC 2015


Hi,

On Fri, 2015-11-06 at 14:01 +0100, Germano Massullo wrote:
> I have done some mistakes in [1]
> 
> 1) I edited the file once to remove 32 bit CPU support, then I have
> done the push to master
> 2) I saw that I have forgotten to add changelog, so I edited the file
> again, I made a new push to master
> 3) I started merging the F21 branch to the master and I got the
> conflict
> 
> I have found a solution like [2], but I am afraid of making things
> get worse...

Assuming you want to have exactly the same thing in F21 and master, and
keep the two branches in sync in the future, here is something that can
get you out of this situation:

First, you need to cleanup the master branch, as you committed some
merge conflict indicators (the <<<<<< ======= and >>>>>>> lines).

So just remove those lines, as well as the "Release: 2%{?dist}" line
(you bumped the release to 3, you don't want to also keep the line
setting it to 2)

Then commit on master.

At this point, you can do this:

 $ git checkout f21
 $ git merge master                       # this causes a merge conflict
 $ git checkout master -- darktable.spec  # solve the conflict by taking the file as it is in master
 $ git commit

At this point, the changes that were in master are now also in f21.

But you're not finished, if you really want to keep the branches in
sync from now on, here's the trick:

 $ git checkout master
 $ git merge f21

Now, both master and f21 are pointing to the exact same commit. So just
push and build.

Next time you make a change in master, just merge it in f21 and you
won't have any conflict any more. :)


-- 
Mathieu


More information about the devel mailing list