Git merge did not happen as expected

2

Hello, I'm going to try to be very practical in my problem.

1 - Working on the 'correction' branch I ended up making changes to different things by mixing things ...

2 - Give to try to 'improve' I created a new child branch

git checkout -b correcao-banco

I have added the specific files of this new branch and commit!

3 - Dai returned to the original branch

git checkout correcao

4 - I added the remaining files and commit!

Now my goal would be to bring into the master only the corrections of the branch 'correction' and nothing of the 'correction-bank'.

5 - I went to the master

git checkout master

6 - I had the merge seen

git merge correcao

A merge happened that was not happy because it gave a fast forward and brought the changes of the 'correction-bank' together ...

Apparently this is the expected behavior but not for me ... I did not understand and now? I have to go back to be able to make changes to the 'correction-bank'?

Thank you.

    
asked by anonymous 10.09.2015 / 22:03

1 answer

1

The process you performed is the correct one in your intent. As you can check in this example extracted directly from Git SCM . So, what may have happened is that the moment you returned to the branch correcao , you have also taken some change of the branch correcao-banco .

On going back, you can revert merge :

# Revertendo commit de merge
git revert -m 1 <merge_commit_sha>

Git Revert documentation.

    
10.09.2015 / 22:54