Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all local git branches without an asterisk [duplicate]

Tags:

git

git-branch

People also ask

How do I clear all local branches?

To delete all branches in Git except main, simply replace the grep for master with a grep for main: git branch | grep -v "main" | xargs git branch -D. git branch | grep -v " main$" | xargs git branch -D.

How can you see all local branches with merged work?

You can use the git merge-base command to find the latest common commit between the two branches. If that commit is the same as your branch head, then the branch has been completely merged.


You can use for-each-ref:

git for-each-ref --format='%(refname:short)' refs/heads/