Git tips

Publishing a branch

# create target repository GIT_DIR=/tmp/stuff git init bare

# tell git about that new repository git remote add stuff /tmp/stuff

# publish your branch git push stuff some-branch:master

# verify that everything worked git clone /tmp/stuff /tmp/check

Re-writing history

Throw away first X commits of a repository

echo $FIRST_SHA >> .git/info/graft git filter-branch -f

Then with interactive git rebase you can rewrite this important initial commit. Of course you have to define $FIRST_SHA and your repo shouldn't be dirty.