How to List all Remote Branches in GIT

  • List all remote branches
# Show only remote branches names
git remote
# Show remote branches names with links
git remote -v
  • Update everything on local from remote
git remote update
* This command will update the local repository with ALL the content at ALL those remotes at git server. It would not show any changes to your local repository but in fact, it would update and create new remote branches in local .git folder. Now whenever we would create a local branch which is already existing at remote, it would fetch from .git folder straightaway to fetch all the contents.
  • Rename remote branch name
git push origin :<old_name> <new_name>
  • Delete remote branch
git push origin --delete <remote-branch-name>
  • Pull remote branch to create local
git pull <repo-name> <remote-branch-name>:<local-branch-name>
E.g.
git pull origin develop:develop
git pull origin features/test/tasks:features/test/mylocaltasks
  • Clean up stale references i.e. Remove all outdated-references from local machine’s cache (i.e. remote/* kind of heads)
git remote prune origin
OR
git fetch -p

* The Content stated above is for informational purpose only. Expert Software Team is not responsible if any part of content found meaningless in any manner or condition.

Leave a Reply

Your email address will not be published. Required fields are marked *