3 ms·
I do the same. alias co='git checkout' alias gb='git branch' alias gd='git diff' alias gr='git reset --hard' alias gs='git status' alias gc='git co
by falcolas 16y ago
I do the same.
alias co='git checkout'
alias gb='git branch'
alias gd='git diff'
alias gr='git reset --hard'
alias gs='git status'
alias gc='git commit'
alias ga='git add'
But I'm moving away from using git status as much, since adding the following to my $PS1:
get_branch () {
GS=$(git status 2>&1)
if [ $? -eq 0 ]
then
STAR='*'
echo $GS | grep 'nothing to commit' > /dev/null 2>&1 && STAR=''
echo -ne "$(echo $GS | grep 'On branch' | cut -d' ' -f4)${STAR}"
else
echo -ne '_'
fi
}
It's a bit slow some days (up to a second to pop up a prompt when the box is busy), but the constant visual reference to my branch name & uncommitted changes is nice.
- mattyb 16y agoYou may find this useful: http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/completion/git-completion.bash;hb=HEAD http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/... It can tell you if your working directory is dirty, if you've got staged changes, what branch/tag you're on, and of course does completion also.