Git pull automatically merges

I have a master branch. and a feature_swap . I want to continue working on these two branches in parallel. I made some change to master and then committed. I wanted to apply some changes to the algorithm from master to feature_swap and see how this version works. Therefore i did

 git pull origin feature_swap 

and received this message

  * branch feature_swap -> FETCH_HEAD Auto-merging collator.h Merge made by recursive. 

I do not want to merge. rather, I just want to put some of the selected changes that I applied to the wizard to feature_swap (maybe when copying). and if this is in line with my expectation, I will make another commit of this branch with these changes. which I want to paralyze again.

I'm afraid I haven't done git push yet. I see Merge branch 'feature_swap' in git log . What do I need to do to recover?

+4
source share
1 answer

Given that the definition of git pull is git fetch && git merge , merging is not unexpected.

Instead, you can make a git rebase master that will reapply the commits to master on feature_swap . In combination with cherry-pick you can specify the required commits.

To fetch from the remote, just use git fetch , which will download the commits from the remote, but not apply them.

+2
source

Source: https://habr.com/ru/post/1436881/


All Articles