Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git pull merges automatically

Tags:

git

merge

pull

I've a master branch and a feature_swap branch. I want to continue working on these two branches in parallel. I did some change on master and then committed. I wanted to apply some algorithm changes of master to feature_swap branch and see how that version works. So I did

git pull origin feature_swap

and got this message

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

I don't want to merge. Rather I just want to put some selected changes that I applied on master to feature_swap (maybe by copy pasting). And if that fits my expectation, I'll make another commit to that branch with those changes. Which I again want paralally.

I'm afraid, I'vent done a git push yet. I can see merge branch 'feature_swap' in git log. What I need to do now to restore the state ?

like image 770
Dipro Sen Avatar asked Sep 28 '12 18:09

Dipro Sen


1 Answers

Considering the definition of git pull is git fetch && git merge, the merge isn't unexpected.

You might want to to do git rebase master instead, which will reapply the commits in master onto feature_swap. Combined with cherry-pick you can specify the commits you want.

To fetch from the remote, simply use git fetch which will download the commits from the remote but doesn't apply them.

like image 64
Femaref Avatar answered Oct 21 '22 21:10

Femaref