Reputation: 1370
So we have master that I do not touch and I'm currently working on feature/project.
I've been doing tons of work on feature/project and then had someone else do a couple things while I was out of office.
His code is the most up to date and it's up on BitBucket.
How do I pull his code and replace my local branch?
EDIT: I did try doing:
Upvotes: 1
Views: 86
Reputation: 30868
git checkout master
git fetch <url> <his-branch>
git reset FETCH_HEAD --hard
url
is the link to the BitBucket repository. his-branch
is the branch where his code is. The commands make your local master
point to his latest commit. If you'd like to update the master
of your own remote repository, you need git push origin -f master
. But doing so, some commits of your local master
would get lost. If you'd like to keep them, run git merge FETCH_HEAD
instead of git reset FETCH_HEAD --hard
.
Upvotes: 2