ReadingNotes
ReadingNotes copied to clipboard
Git Tips
Subscribe to this issue and stay notified about new notes.
git reflog
reference logs, record when the tips of branches and references were updated in the local repository.
$ git reflog
4c5ce5c (HEAD -> master, origin/master, origin/HEAD) HEAD@{0}: commit: improving ch6
df4b14e HEAD@{1}: commit: fixed slack invite link.
ac137fd HEAD@{2}: pull -v --progress origin: Fast-forward
80757d8 HEAD@{3}: commit: added slack group link.
023e41a HEAD@{4}: clone: from [email protected]:pezy/CppPrimer.git
To move to the desired state you just need to run a checkout using the absolute reference:
git checkout 023e41a
or just using the relative reference:
git checkout HEAD@{4}
git revert
git revert is used to record some new commits to reverse the effect of some earlier commits(often only a faulty one). This requires your working tree to be clean(no modifications from the HEAD commit).