Yan Pritzker photographer, entrepreneur, software engineer, musician, skier

Blog :: Git Workflows Book :: Dotfiles :: Photography :: About Me

TwitterCounter for @skwp

Get the news feed
Get updates by email
Follow me on twitter

hello, i'm yan

I am a photographer, entrepreneur, software engineer, guitarist, climber, and telemark skier

This blog is about startups, blogging, Ruby On Rails, virtualization and cloud computing, photography, customer service, marketing, ux and design, git, and lots more.

Enterprise intelligence with prediction markets

Find out what your team, colleagues and partners really know about the future — and leverage their knowledge to improve business decisions.

I'm the founder of Planypus, the place to share your plans!

Archives

Contact

Reach me at yan at pritzker.ws

More git tips and tricks

Posted 1 May 2008 @ 9pm | Tagged git, thoughts


Submit to HN

Here are a couple more fun git commands and configuration tricks.

Make some aliases because typing ‘checkout’ is a pain. In ~/.gitconfig:
Note the quicklog command below uses a custom log format which shows you a short hash, a relative date (“4 hours ago”) and the commit message. I created it by reading the git log formatting manpage.


[alias]
  ci = commit
  co = checkout
  b = branch
  nb = checkout -b
  stat = status
  sl = stash list
  sa = stash apply
  sd = stash drop
  quicklog = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\"
  changes = log --pretty=oneline
  svnup = svn rebase
  svnpush = svn dcommit

I really love the ‘nb’ alias, which I use to mean ‘new branch’. It lets me very quickly create and switch to a new branch “git nb fixing_bug_123″.

Display the current branch in your bash prompt. Modified from here.


export MANPATH=/usr/local/git/man:$MANPATH
 function parse_git_branch {
   git branch 2> /dev/null | \
	sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'
 }
export PS1='\u@\H:\w $(parse_git_branch)$ '

Get a nice list of change summaries, one line per change

git log --pretty=oneline --since="2 weeks ago" --until="yesterday"

See what changed from one commit set to another (these can be branch names)

git log my-branch..master

See which files changed in the log

git log --name-status

Browse your local repo with a web interface

git instaweb --httpd=webrick

Want to reorder previous commits, squash commits, and generally wreak havoc?
The following command opens up an interactive editor with the last 10 commits.

git rebase -i HEAD~10


No Comments Yet


There are no comments yet. You could be the first!

Leave a Comment