Listing branches
suggest changeGit provides multiple commands for listing branches. All commands use the function of git branch, which will provide a list of a certain branches, depending on which options are put on the command line. Git will if possible, indicate the currently selected branch with a star next to it
| Goal | Command |
|---|---|
| List local branches | git branch |
| List local branches verbose | git branch -v |
| List remote and local branches | git branch -a OR git branch --all |
| List remote and local branches (verbose) | git branch -av |
| List remote branches | git branch -r |
| List remote branches with latest commit | git branch -rv |
| List merged branches | git branch --merged |
| List unmerged branches | git branch --no-merged |
| List branches containing commit | git branch --contains [<commit>] |
Notes:
- Adding an additional
vto-ve.g.$ git branch -avvor$ git branch -vvwill print the name of the upstream branch as well. - Branches shown in red color are remote branches
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents