git referencing using ^ and ~
This commit is contained in:
parent
7c285cfdc3
commit
33cc143bf2
18
README.md
18
README.md
@ -14,9 +14,27 @@ git reset --soft # resets #3 only
|
|||||||
git reset (--mixed) # resets #3 and #2
|
git reset (--mixed) # resets #3 and #2
|
||||||
git reset --hard # resets all #3, #2 and #1
|
git reset --hard # resets all #3, #2 and #1
|
||||||
```
|
```
|
||||||
|
***
|
||||||
## git rebase
|
## git rebase
|
||||||
```
|
```
|
||||||
git rebase <hash> # rebase using commits's hash
|
git rebase <hash> # rebase using commits's hash
|
||||||
git rebase -i HEAD~n # interactive rebase for last n commits
|
git rebase -i HEAD~n # interactive rebase for last n commits
|
||||||
```
|
```
|
||||||
|
***
|
||||||
|
## git commit referencing using ^ and ~
|
||||||
|
```
|
||||||
|
~n # follows straight history in one branch
|
||||||
|
^ = ^1 # first parent
|
||||||
|
^n # n parent
|
||||||
|
^^^2 # first parent/first parent/second parent
|
||||||
|
```
|
||||||
|
To practice referencing checkout "merge" branch and use some command to see what commints are referenced.
|
||||||
|
```
|
||||||
|
git log --oneline -1 HEAD~4
|
||||||
|
git log --oneline -1 HEAD~4^2^
|
||||||
|
etc...
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user