DEV Community

→ Ale Narvaja
→ Ale Narvaja

Posted on

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

Top comments (0)