Skip to content

Instantly share code, notes, and snippets.

@sysout
Last active May 4, 2016 18:35
Show Gist options
  • Save sysout/05f6da4402cbb0a11d126f28bb4e32f6 to your computer and use it in GitHub Desktop.
Save sysout/05f6da4402cbb0a11d126f28bb4e32f6 to your computer and use it in GitHub Desktop.
# That filters the git log with commits that have at least two parents.
git log --min-parents=2 -p --cc
git help revisions brings up http://git-scm.com/docs/gitrevisions, which describes all the the most common ways to reference commits:
HEAD names the commit on which you based the changes in the working tree.
FETCH_HEAD records the branch which you fetched from a remote repository with your last git fetch invocation.
ORIG_HEAD is created by commands that move your HEAD in a drastic way, to record the position of the HEAD before their operation, so that you can easily change the tip of the branch back to the state before you ran them.
MERGE_HEAD records the commit(s) which you are merging into your branch when you run git merge.
CHERRY_PICK_HEAD records the commit which you are cherry-picking when you run git cherry-pick.
From the git source, you can also find out about BISECT_HEAD, REVERT_HEAD, REJECT_NON_FF_HEAD and several others that you will almost certainly never need.
That reference also explains suffixes (^N, ~N, @{...}), ranges (.. vs ...), and more.
# git clean removes all untracked files and git checkout clears all unstaged changes.
git clean -df
git checkout -- .
# preview a git merge and reset back
git merge --no-commit --no-ff $BRANCH
git reset --hard HEAD
# see the change history of one file
git log -p config/settings.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment