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 to get the current branch name in Git?
- How do you create a remote Git branch?
- Make an existing Git branch track a remote branch?
- 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?
- How to use Git Revert
- How do I properly force a Git push?
- Git submodule update
- What does ‘git merge –abort is equivalent to git reset –merge when MERGE_HEAD is present.’ of Git merge man page mean?
- How to modify existing, unpushed commit messages?
- Git pushing to remote branch
- How to revert a merge commit that’s already pushed to remote branch?
- GitHub Error Message – Permission denied (publickey)
- How do you push a tag to a remote repository using Git?
- Gitignore not working
- How do I resolve git saying “Commit your changes or stash them before you can merge”?
- How do I fix a Git detached head?
- Why does git say “Pull is not possible because you have unmerged files”?
- How to cherry-pick multiple commits
- Another git process seems to be running in this repository
- rejected master -> master (non-fast-forward)
- merge one local branch into another local branch
- Git error on commit after merge – fatal: cannot do a partial commit during a merge
- Is there a “theirs” version of “git merge -s ours”?
- Meaning of the GitHub message: push declined due to email privacy restrictions
- Is there a command to undo git init?
- Download a single folder or directory from a GitHub repo
- Is there a “git touch” so I can push the same file with a new timestamp?
- Hard reset of a single file
- .gitignore and “The following untracked working tree files would be overwritten by checkout”
- git add remote branch
- Undo a git stash
- Undo git stash pop that results in merge conflict
- How to clone all remote branches in Git
- Invalid VCS root mapping – 3 errors on my project
- Unity Collaborate vs GitHub
- SourceTree keeps asking for Github password
- How to change the license for a project at Github?
- How do i git push specific branch?
- Git add all files modified, deleted, and untracked?
- How to switch back to ‘master’ with git?
- Github Authentication Failed – … GitHub does not provide shell access
- How do I pull files from remote without overwriting local files?
- Your repository has no remotes configured to push to
- Specify an SSH key for git push for a given domain
- How do I “un-revert” a reverted Git commit?
- git push not send changes to remote git repository
- How to merge a specific commit in Git
- How to use Git and Dropbox together?
- Git: Where exactly is the “working directory”?
- What exactly does the “u” do? “git push -u origin master” vs “git push origin master”
- Updating and committing only a file’s permissions using git version control
- What is the usual process of saving changes made at the CMS level into source control?
- Add latest commit info on login footer using login_footer hook
- Display GitLab repositories of the logged in user on a page