skwpspace it’s pronounced ’scoop’. yan pritzker’s home on the web

Blog :: Photography :: About Me

hello, i'm yan

I blog here occasionally. I hope you like it.

Subscribe by Email

planypus

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

cohesiveft

Accessible, manageable, virtualized application stacks ready to download or deploy to the cloud!

flickr

starlightthe playersredmoon theater - boneyard prayerredmoon theater - boneyard prayer-5redmoon theater - boneyard prayermetal goddessmetal monstersprofessor

Archives

Contact

Reach me at yan at pritzker.ws

Posted
1 May 2008 @ 9pm

Tagged
git, thoughts

More git tips and tricks

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

bluehost.com ignores customer complaints on database downtime Ponoko brings product design to the masses