A mind less ordinary

18Aug/100

Useful git configuration fragments

Time for a quick micro-post, I think. I feel like sharing two useful fragments of my git configuration.

First up, aliases. I have a few useful shortcuts defined, as well as some nice ways of displaying a repository's history. I've aliased many of the common commands to two-letter versions which evoke the similar Subversion command aliases:

[alias]
  st = status
  di = diff
  co = checkout
  ci = commit
  br = branch
  sta = stash
  graph = log --decorate --oneline --graph --branches --date-order
  lg = log --graph --pretty=format:'%C(yellow)%h%Creset -%C(yellow)%d%Creset %s %C(green)(%cr)%Creset %Cred<%an>%Creset' --abbrev-commit --date=relative --date-order
  today = !git log --author=$(git config user.email) --since=yesterday
29Jun/100

Cloning a git-svn checkout

The scenario is that you have used git-svn to import an SVN repository, and you want to make use of the already-imported commits elsewhere. Unfortunately, git clone does not (currently) clone the git-svn information. It looks like we have to fully rebuild the git-svn repository, which would then mean pulling every commit from the Subversion server once again. What we'd really like to do is to make use of history we already have from git.