Helpful git commands

Status-related commands

  • Show the status of the current project (eg files changed, unknown files, etc.)
git status
  • Show the status of only files known to git (excludes unknown files):
git status -uno
  • Show the status of the submodules:
git submodule status

Prune deleted branches

To have your local git repositories reflect cleanup (deletion of topic branches) on the remote (removing deleted branches from your local), simply do:

git fetch --prune

To do this for all repositories, you can do the following:

cd $DAKOTA_ROOT
git fetch --prune
git submodule foreach git fetch --prune
cd local
git fetch --prune
git submodule foreach git fetch --prune

Bad rebase recovery

The Git reflog command can be helpful in recovering from a bad rebase, though we recommend doing this in concert with someone from the infrastructure team who is highly Git saavy.  Helpful notes: http://stackoverflow.com/questions/134882/undoing-a-git-rebase