0

Suppose you make a branch called test from a called branch master . Then the master branch is updated with some changes. What is the best way to update your branch test with the latest master branch without overwriting your changes in test ?

Basically, I did the following:

git clone git@project.git 
git checkout -b test

Make changes to test . But now master has been updated. So when I do the following:

git add .
git commit -m "updated test"
git push origin test

it is working with the older version of master. How do I use the newest version?

Mureinik
  • 277,661
  • 50
  • 283
  • 320
stackguy1723
  • 123
  • 9

2 Answers2

2

You should rebase your branch on top of the remote master.

First, fetch the least changes:

git fetch origin

And then rebase your branch:

git rebase origin/master
Mureinik
  • 277,661
  • 50
  • 283
  • 320
0

I think:

git pull origin master 
script0
  • 292
  • 7