khernik
khernik

Reputation: 2091

Merge branches without uncommitted changes

I was on master branch doing a lot of changes. Right now I'd like to stash those changes, switch branch to dev, and reapply those changes (stash) there.

I did it, now I am on dev branch having all my uncommitted changes ready for commit.

But I found out dev branch is not up to date, and I have to merge master into dev, and only then I can commit my changes.

The problem is that this merge gives me conflicts. And I can't see what files to merge, because they mix with my uncommitted changes.

How can I solve this?

Upvotes: 2

Views: 58

Answers (1)

Suluvai
Suluvai

Reputation: 86

Stash your changes again, make sure your dev branch is on latest HEAD. Now merge Master branch into dev branch. You do not need to choose files. You can choose a commit to merge and it will merge all the change sets until that commit. It will only merge those changed files.

Now re-apply your stash. It will cause conflicts, on applying stash it will notify the conflicted files. Now you can easily go through each conflicted file and pick the correct change-set.

Upvotes: 3

Related Questions