0

I have sample where git merge gives unexpected for me result.

Here master branch has commit #3 with unwanted changes. I checkouts to stable commit #2 and creates new branch with additional usage. Can I merge new_branch into master with all three lines? Thanks for help!

Commit tree

Link to repository

Raffaele
  • 20,627
  • 6
  • 47
  • 86
Dmitry
  • 31
  • 5

2 Answers2

1

You can merge new_branch into master then revert #3.

Or, you can reset master to new_branch

git checkout master git reset --hard new_branch

xuanduc987
  • 1,067
  • 1
  • 9
  • 10
0

you should make commit #3 and #4 into new_branch, try rebase command

git checkout new_branch
git rebase master
git checkout master
git merge new_branch

If there is a conflict, you should resolve it.

Or just make your changes into the master branch

yanghaogn
  • 833
  • 7
  • 15