Git#

For hosting see Gitolite and Gitlab.

Bisect#

Simple, auto:

git bisect start BAD_COMMIT GOOD_COMMIT
git bisect run test_runner tests/

Reset Local Master Branch to State of Remote Master#

git checkout master
git branch failmaster
git reset --hard origin/master

Explanation:

  1. go to master branch

  2. (optional) save it as “failmaster” and go there (we need to go somewhere else than master for the next step)

  3. reset to origin/master, ignoring all local changes

Push all branches from one remote to another#

To push all branches present in the remote origin to the new remote serv:

source=origin
destination=serv
git push $destination +refs/remotes/$source/*:refs/heads/*

Source: http://stackoverflow.com/a/16044860/241240

Log with Author Date#

By default git shows the “commit” date. When rebasing a branch all commit dates are a few seconds old even if they were authored months ago. Here are my short log entries - one with relative dates and another with ISO dates, e.g. 2014-06-04 15:11:47.

[alias]
# http://coderwall.com/p/euwpig?i=3&p=1&t=git
l = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ar) %C(bold white)<%an>%Creset' --abbrev-commit
# hack to remove timestamp offset http://stackoverflow.com/questions/7853332/git-log-date-formats
lf = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ai%x08%x08%x08%x08%x08%x08) %C(bold white)<%an>%Creset' --abbrev-commit