git branch
should show all the local branches of your repo. The starred branch is your current branch.
If you want to retrieve only the name of the branch you are on, you can do:
git rev-parse --abbrev-ref HEAD
or with Git 2.22 and above:
git branch --show-current
Related Posts:
- How to remove local (untracked) files from the current Git working tree
- Git fetch remote branch
- Git fetch remote branch
- How do you create a remote Git branch?
- Make an existing Git branch track a remote branch?
- How to get the current branch name in Git?
- How do you create a remote Git branch?
- Branch from a previous commit using Git
- How do I run git log to see changes only for a specific branch?
- How do I delete a Git branch locally and remotely?
- How do I delete a Git branch locally and remotely?
- How do I rename a local Git branch?
- What is the best (and safest) way to merge a Git branch into master?
- Git merge hotfix branch into feature branch
- How do I clone a specific Git branch? [duplicate]
- How do I push a new local branch to a remote Git repository and track it too?
- How do I list all remote branches in Git 1.7+?
- How do I push a new local branch to a remote Git repository and track it too?
- How do I push a new local branch to a remote Git repository and track it too?
- How to fetch all Git branches
- How to get just one file from another branch?
- How to fetch all Git branches
- Update Git branches from master
- Create a branch in Git from another branch
- How do I rename both a Git local and remote branch name?
- Create Git branch with current changes
- Why do I have to “git push –set-upstream origin
“? - Move the most recent commit(s) to a new branch with Git
- How to pull a specific branch from Github
- Move the most recent commit(s) to a new branch with Git
- How do I call git diff on the same file between 2 different local branches?
- Why do I have to “git push –set-upstream origin
“? - master branch and ‘origin/master’ have diverged, how to ‘undiverge’ branches’?
- git pull from master into the development branch
- Not a valid object name: ‘master’
- Your configuration specifies to merge with the
from the remote, but no such ref was fetched.? - How can I copy the content of a branch to a new local branch?
- How do I copy a version of a single file from one Git branch to another?
- Set up git to pull and push all branches
- Git: Merge a Remote branch locally
- Move existing, uncommitted work to a new branch in Git
- How do I clone a single branch in Git?
- how to reset develop branch to master
- Delete branches in Bitbucket
- How do I push a local Git branch to master branch in the remote?
- How to keep a branch synchronized/updated with master?
- How to create a local branch from an existing remote branch?
- How can I delete all Git branches which have been merged?
- How to find which git branch I am on when my disk is mounted on other server
- How to create a new branch from a tag?
- What is git tag, How to create tags & How to checkout git remote tag(s)
- Squash my last X commits together using Git
- How to apply a patch generated with git format-patch?
- Abort a Git Merge
- How to delete a remote tag?
- Updates were rejected because the tip of your current branch is behind its remote counterpart
- What does “Changes not staged for commit” mean
- git: fatal: Could not read from remote repository
- How do I update Homebrew?
- Gitignore not working
- Could not open a connection to your authentication agent
- git checkout a single file from another branch and put in different folder
- Stash only one file out of multiple files that have changed with Git?
- What is HEAD in Git?
- What are the differences between git remote prune, git prune, git fetch –prune, etc
- How do I resolve git saying “Commit your changes or stash them before you can merge”?
- How do you stash an untracked file?
- Filename too long in Git for Windows
- What is the difference between git rm –cached and git reset
? - What does git rev-parse do?
- git – pulling from specific branch
- GitHub: invalid username or password
- Stash just a single file
- How do I provide a username and password when running “git clone [email protected]”?
- “*** Please tell me who you are.” when using SSH key
- Clone A Private Repository (Github)
- How to create the branch from specific commit in different branch
- Is there a “theirs” version of “git merge -s ours”?
- How to clone a specific Git tag
- Heroku: How to change a Git remote on Heroku
- Updates were rejected because the remote contains work that you do not have locally
- Undoing a ‘git push’
- What’s the significance of the “No newline at end of file” log?
- Git update submodules recursively
- Do a “git export” (like “svn export”)?
- How do I set up Eclipse/EGit with GitHub?
- Repository size limits for GitHub.com
- git push origin master does not work
- Git clone verbose output?
- Could not create work tree dir ‘example.com’.: Permission denied
- How to answer the git prompt in npm init for a local repo
- Git says “Automatic merge failed”, what does it mean?
- How to configure git bash command line completion?
- How to stop tracking and ignore changes to a file in Git?
- WordPress and Git – What folders should I track?
- Pull latest stable release via git [closed]
- Why do the Roots theme CSS files not load (404)?
- Painless way to track remote Git repo for WordPress updates
- WordPress on git – need help with configuration
- How to retrieve the last modification date of all files in a Git repository