From 9e1c05868562ec69b86005441fc4b78b9127fc23 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Thu, 10 Sep 2015 12:41:25 +0800 Subject: [PATCH] git-revisions: add examples --- git-revisions.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/git-revisions.md b/git-revisions.md index 55f227dac..95aa26332 100644 --- a/git-revisions.md +++ b/git-revisions.md @@ -44,6 +44,7 @@ title: Git revisions | `master...fix` | reachable from *fix* and *master*, but not both | | `HEAD^@` | parents of *HEAD* | | `HEAD^!` | *HEAD*, then excluding parents's ancestors | +| `HEAD^{:/fix}` | search previous *HEAD*s matching criteria | {:.shortcuts} ### Ranges illustration @@ -55,3 +56,13 @@ A -+- E - F - G master master..fix = BCD master...fix = BCD and EFG ``` + +## Example usages + +```sh +git log master...develop # inspect differences in branches +git rebase -i HEAD~3 # rebase last 3 commits +git reset --hard HEAD@{2} # undo last operation that changed HEAD +git show ":/fix bug" # search commit with regex +git checkout v2^{} # checkout the `v2` tag (not `v2` branch) +```