Question

I am currently working on a branch foo and a colleague has made changes that are part of master. I have uncommitted changes on my branch, which I want to keep, but would also like to bring down the recent changes that are now part of master.

I assumed that git merge origin/master would do this (i.e. merge that location with my current branch). To perform the merge, it would keep my local work, and apply any changes from the repo that weren't part of my local changes.

However, this doesn't seem to work. It seems not to do anything.

ems@host:~/test$ git merge origin/master
Already up-to-date.

On the other hand, this answer suggests that you can't even do this action, and must merge uncommitted changes first before pulling.

What is the correct way to bring down changes from master to a current branch without being forced to commit work in progress?

Was it helpful?

Solution

git pull origin master should work, but I think you can stash your changes, pull from master than apply the stash so:

git stash 
git pull origin master [or origin/master if you want to use the local stored branch]
git stash apply
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top