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
  • 297,002
  • 52
  • 306
  • 350
stackguy1723
  • 165
  • 1
  • 2
  • 12

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
  • 297,002
  • 52
  • 306
  • 350
1

I think:

git pull origin master 
script0
  • 387
  • 2
  • 12