Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I update the remote branches list in Git from the server?

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?

like image 631
Kate Zz Avatar asked Sep 18 '15 12:09

Kate Zz


People also ask

Does git pull update remote branch?

git pull updates your current local working branch, and all of the remote tracking branches.

Which command used to update our local branches from the remote?

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.


1 Answers

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
like image 79
Code Prank Avatar answered Sep 19 '22 19:09

Code Prank