The H2 Wiki


git-survival-guide

A Git survival guide

Roughly orthogonal git commands

Things I don’t do

Advanced stuff

All the things your branch has ever been

Are you scared that you’ve lost commits because of a rebase gone wrong or some other git mystery? Try this command with the name of your branch in the place of <branch>.

BRANCH=<branch>; git log --graph --pretty=format:"%C(yellow)%h%Creset %cr: %s%d (Authored %ar)"   `git reflog $BRANCH | cut '-d ' -f1`

(Yes, it’s long, and you should put it all on one line). You will be presented with a tree that contains everything that has even been on the given branch. You can then reset your branch to one of its earlier versions and perhaps cherry-pick into it commits from other versions.

All the changes to files you care about

git fetch && PAGER="less '+/^commit'" git log --patch --since="1 week" --extended-regexp --author='^([^T]|.[^o])' -- $(git rev-list --since="1 month" --author="Tom Ellis" origin/master | while read commit; do git diff-tree --no-commit-id --name-only -r $commit; done)

Explicit git

What a rebase/merge is

TODO: explain how conflicts mean you have to merge the semantic content of both patches

Darcs translation