0

How does one get the code from the master to the local branch called "mybranch" so the local branch has the latest code? Assume local branch did not have code changed since it was created from master and now it is few versions behind the master.

dkgcb
  • 81
  • 1
  • 2
  • 9

3 Answers3

1

I've ran the following commands, which pulled the latest changes from master.

git checkout mybranch

git pull origin master

Community
  • 1
  • 1
dkgcb
  • 81
  • 1
  • 2
  • 9
0

checkout to your branch:

git checkout mybranch

then update master and rebase your branch.

git pull --rebase origin master

this is in case you don't mind rebasing and also updating master. You could also not rebase (say, if mybranch is in the remote and you don't want to remove it to be able to push later) and just merge with

git pull origin master
0

You can do that with

git fetch upstream
git merge upstream/master

Assuming that you are on your local branch.

source

mrfred489
  • 80
  • 1
  • 7