I was working on a local branch and I needed to pull down one of the branches from origin so I issued the following command:
git pull origin design
When I did that, that branch ended up being merged into my current local branch which is not what I wanted at all. So I need to do 2 things:
- How do I revert this merge back out of my local branch?
- How do I pull a branch from origin without it doing this merge?
To back out a merge commit created by the
pull:If the merge was a fast-forward merge (meaning you hadn’t done any work locally), then
git reset --hardto the sha1 of the last commit you want to keep locally.To fetch a remote branch without merging:
The remote branch will appear as something like
origin/master(withgit branch -a).