TIL - Git: fetch changes from a remote branch to a different local branch

alebarbaja

→ Ale Narvaja

Posted on March 11, 2022

TIL - Git: fetch changes from a remote branch to a different local branch

Today I learned that if I want to fetch changes from a remote branch to a different local branch, all I have to do is:

git checkout <local-branch>
git pull origin <remote-branch>
Enter fullscreen mode Exit fullscreen mode

For example, if I would like to fetch changes from master to a test branch:

git checkout test // we move to test branch
git pull origin master // we pull data from master to test
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
alebarbaja
→ Ale Narvaja

Posted on March 11, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related