Hacker News new | past | comments | ask | show | jobs | submit login

I use bash aliases for the same thing:

alias gs='git status'

alias gc='git commit -m'

alias gca='git commit -a -m'

alias gd='git diff'

I spend most of my time with gs and gd, then usually gca my changes all at once, or add those I want and use gc.




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.


You may find this useful:

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.


Instead of "git diff" followed by "git commit -a -m", I like to do: "git add -p" followed by commit.

You get to see the diff, piece by piece, and separate the independent fixes.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: