I know this has been answered already, but in the most recent version of Git the command git branch
opens a list of your branches in some kind of prompt that you have to quit out of. Which annoys me to no end!
Here's my fix: Open your bash profile and type this in:
#!/bin/bash
git() {
if [[ $@ == "branch" ]] then
command git branch -a | grep -v 'remotes'
else
command git "$@"
fi
}
Now open Terminal and test it out by typing the following commands in a git repo:
source ~/.zshrc
git branch
And voila! A list of your local branches is printed out in your terminal.
The code you're writing to your bashrc file overwrites the default function for git branch
and replaces it with a much longer command that lists all local branches via the -a
argument. Then we grep
out the extra not needed business and print it out. If you exclude the grep
command you'll still get the annoying prompt. If you're not familiar with writing bash commands checkout this explanation: About .bash_profile, .bashrc, and where should alias be written in?