How can I update the remote branches list in Git?
I have pushed a branch to Git on the server. On the second local copy of the repository, I want to get that branch and do:
show branch -r
But I don't have the new branch in this list.
How can I update Git's remote branch list?
git pull updates your current local working branch, and all of the remote tracking branches.
git fetch is used in conjunction with git remote , git branch , git checkout , and git reset to update a local repository to the state of a remote. The git fetch command is a critical piece of collaborative git work flows.
You can use the following commands to update the list of local branches from remote:
git fetch --prune
git pull --prune
Also you can set to update the local list of remote git branches automatically every time you run git pull
or git fetch
using below command.
git config remote.origin.prune true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With