When running the git pull command, you retrieve the latest changes of your current branch from the remote repository.
To find out which branch you are currently working on, you can use git status:
ck@mint ~/Git/myrepo $ git status
On branch main
nothing to commit, working tree clean
Sometimes you want to pull the changes from another branch, which has not yet been downloaded to your local machine.
To do that, you can use git pull but with the wanted branch added to the command:
ck@mint ~/Git/myrepo $ git pull origin systemd-improvements
From ssh://git.example.com/group/myrepo
* branch systemd-improvements -> FETCH_HEAD
Updating 288c86e..0d0cfeb
Fast-forward
myapp.spec | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
After pulling the additional branch "systemd-improvements" from the remote repository, you can now locally change to this branch and continue working on it:
ck@mint ~/Git/myrepo $ git checkout systemd-improvements
branch 'systemd-improvements' set up to track 'origin/systemd-improvements'.
Switched to a new branch 'systemd-improvements'