git-revisions: add examples

This commit is contained in:
Rico Sta. Cruz 2015-09-10 12:41:25 +08:00
parent e1e3172552
commit 9e1c058685
1 changed files with 11 additions and 0 deletions

View File

@ -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)
```