user3411864
user3411864

Reputation: 644

How to avoid recurring git rebase conflicts

I have a real estate website that is becoming more complex to control in git. But it only has two branches, so it shouldn't be that difficult. The master branch is the version that is live. And the dev branch is stuff that is new and has to put online. But dev stuff is taking super long, like half a year of discussions and minor changes. In the meanwhile the live master version gets all kinds of updates and hot fixes.

So what I do is rebasing dev on top of master every week and solve the conflicts. But on every rebase I keep getting the previous fixed conflicts.

So like in this situation:

[1]-[2]-[4]-[5]-[6]-[7]-[master]
                  \
                  [1]-[2]-[3]-[4]-[5]-[6]-[dev]

So the master[7] commit was just an extra slider image added. When I rebase dev just on top of master I get again all the conflicts in my menu and content differences to fix that I previously already solved. Doesn't it remember the solved conflicts?

Upvotes: 1

Views: 638

Answers (2)

Matthew Hallatt
Matthew Hallatt

Reputation: 1380

Take a look at gitflow: http://danielkummer.github.io/git-flow-cheatsheet/

Basically an add-on for git that adds helpful functionality, especially when it comes to features and hotfixes.

git flow hotfix start VERSION

This would begin your hotfix on it's own branch. Once your changes are done - be it adding slider images or fixing a bug - run the following:

git flow hot fix finish VERSION

This would then automatically merge the code in to develop and master. You can also optionally tag the master branch.

Hopefully this happening each time a change is made will remove any unnecessary conflicts!

Upvotes: 0

jbu
jbu

Reputation: 16131

Try git rebase --preserve-merges and take a look at What exactly does git's "rebase --preserve-merges" do (and why?)

Possible duplicate of How to cherry-pick/rebase/etc the end result of conflict resolve

As noted you may need rerere enabled (stands for reuse recorded resolution), but I don't believe you do.

Upvotes: 1

Related Questions