Reputation: 2539
I have 2 branches (master and dev). Another worker has pushed a new branch called stage into the repository so that stage is now 1 commit ahead of master. I am trying to pull down stage so that I can merge it into master (and thus merge into dev), but I am having issues pulling down stage. How do I pull down a clean version of stage?
Upvotes: 2
Views: 194
Reputation: 24844
I don't think you understand the branching basics of Git here. You may understand a bit more after reading my answer, by example.
You should fetch all updates
git fetch --all
then you should see the now still remote branch:
git branch -a
[...]
remotes/origin/stage
Optionally, you can make this branch a local branch stage
(does not have to have the same name) by checking it out
git checkout -b stage origin/stage
And you should be switched onto this branch with this.
Now back to master and merge it:
git checkout master
git merge origin/stage # or just 'stage' if you have it local
Now, one could combine both fetch
and merge
steps by a single pull
. However, sometimes it's needed to fetch new branches and their heads in order to be able to specify them.
git pull origin stage
Upvotes: 3
Reputation: 1323973
This should work:
git checkout master
git pull origin stage
Considering master
isn't linked to stage
at all, you need to specify from where you are pulling, and what you are merging.
See:
Git pull/fetch
with refspec differences"git - push current
vs. push upstream
(tracking)" for more.Upvotes: 0