git:git_reflog
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
git:git_reflog [2016/11/21 12:07] – peter | git:git_reflog [2019/11/29 15:06] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== GIT - git reflog ====== | ||
- | This log is updated when the HEAD gets updated. | ||
- | |||
- | * Switching branches | ||
- | * Pulling in new changes | ||
- | * Adding new commits | ||
- | * Rewrites to history | ||
- | |||
- | This command will show you the history of your local repository. | ||
- | |||
- | <code git> | ||
- | git log --oneline | ||
- | 00617f7 add bacon file | ||
- | baee97e add new feature | ||
- | 62f8afd did bug fix | ||
- | ed937bb initial commit | ||
- | </ | ||
- | |||
- | <code git> | ||
- | git reset --hard 62f8afd | ||
- | HEAD is now at 62f8afd did bug fix | ||
- | |||
- | ls | ||
- | index.html | ||
- | </ | ||
- | |||
- | <code git> | ||
- | git reflog | ||
- | 62f8afd HEAD@{0}: reset: moving to 62f8afd | ||
- | 00617f7 HEAD@{1}: commit: add bacon file | ||
- | baee97e HEAD@{2}: merge new feature: Fast-forward | ||
- | 62f8afd HEAD@{3}: checkout: moving from new-feature to master | ||
- | baee97e HEAD@{4}: rebase finished: returning to refs/ | ||
- | baee97e HEAD@{5}: rebase: add new feature | ||
- | 62f8afd HEAD@{6}: checkout: moving from master to 62f8afd8bc86ec01e3472df | ||
- | 62f8afd HEAD@{7}: merge bug-fix: Fast forward | ||
- | ed937bb HEAD@{8}: checkout: moving from bug-fix to master | ||
- | 62f8afd HEAD@{9}: commit: did bug fix | ||
- | ed937bb HEAD@{10}: checkout: moving from master to bug-fix | ||
- | ed937bb HEAD@{11}: checkout: moving from new-feature to master | ||
- | ff70d17 HEAD@{12}: commit: add new feature | ||
- | ed937bb HEAD@{13}: checkout: moving from master to new-feature | ||
- | ed937bb HEAD@{14}: commit (initial): initial commit | ||
- | |||
- | git reset --hard 00617f7 | ||
- | HEAD is now at 00617f7 add bacon file | ||
- | |||
- | ls | ||
- | bacon.html index.html new-feature.html | ||
- | </ | ||
- | |||
- | You could always use **git reset –hard [commit hash]** to revert accidentally changes. |
git/git_reflog.1479730038.txt.gz · Last modified: 2020/07/15 09:30 (external edit)