Find the Right Git Command With Git Explorer

19th February 2020 PERMALINK • 1 min read

If you’ve ever wanted to do something in Git via the command line, but you’re just not quite sure what the command is. Or you roughly know what you want to do, but don’t know where to start, then Git Explorer is the perfect tool.

All you need to do is select from of them 19 options after “I want to”, and that can be something like “I want to compare two commits” or “I want to configure”. Then you get further options to refine the query, and it shows you the exact command you need.

For example, if you wanted to remove multiple branches that matched a certain pattern, then you just need to select these options:

I want to

  • delete/remove
  • multiple branches
  • by pattern

Then you get told the command:

git branch | grep <regex pattern> | xargs git branch -D

And also a helpful note to help you understand it:

e.g. git branch | grep “-” | xargs git branch -D will delete all branches that have ‘-‘ in their names or git branch | grep -v “master|staging” | xargs git branch -D will delete all branches except staging and master.

NB: Always put your regex pattern in quotes

I use Git via the command line myself, but there’s always the odd scenario where I can’t quite figure out the command or proper syntax, so this website will be perfect for me. It’s going straight into my bookmarks.

Check out Git Explorer.