diff options
author | Adam Bard <github@adambard.com> | 2016-05-10 11:32:14 -0700 |
---|---|---|
committer | Adam Bard <github@adambard.com> | 2016-05-10 11:32:14 -0700 |
commit | 18632385420c026f7d6b60d2e44ec1f844616e77 (patch) | |
tree | ae67cfb41e4a2c0a009d2d696afb6680ec98c667 /git.html.markdown | |
parent | ef486c21197c30d39399f695bb5414b50ef6c4ac (diff) | |
parent | ddedb40ef88a8c7b0d26e0aaea0efb4b50ce521f (diff) |
Merge pull request #2252 from SpiritBreaker226/feature/add_git_reflog
Add Git Reflog Section To Git.html.markdown
Diffstat (limited to 'git.html.markdown')
-rw-r--r-- | git.html.markdown | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/git.html.markdown b/git.html.markdown index 6472c462..4d4b2a4e 100644 --- a/git.html.markdown +++ b/git.html.markdown @@ -7,6 +7,7 @@ contributors: - ["Betsy Lorton" , "http://github.com/schbetsy"] - ["Bruno Volcov", "http://github.com/volcov"] - ["Andrew Taylor", "http://github.com/andrewjt71"] + - ["Jason Stathopulos", "http://github.com/SpiritBreaker226"] filename: LearnGit.txt --- @@ -520,6 +521,31 @@ $ git reset 31f2bb1 $ git reset --hard 31f2bb1 ``` +### reflog (caution) + +Reflog will list most of the git commands you have done for a given time period, +default 90 days. + +This give you the a change to reverse any git commands that have gone wrong +for instance if a rebase is has broken your application. + +You can do this: + +1. `git reflog` to list all of the git commands for the rebase +``` +38b323f HEAD@{0}: rebase -i (finish): returning to refs/heads/feature/add_git_reflog +38b323f HEAD@{1}: rebase -i (pick): Clarify inc/dec operators +4fff859 HEAD@{2}: rebase -i (pick): Update java.html.markdown +34ed963 HEAD@{3}: rebase -i (pick): [yaml/en] Add more resources (#1666) +ed8ddf2 HEAD@{4}: rebase -i (pick): pythonstatcomp spanish translation (#1748) +2e6c386 HEAD@{5}: rebase -i (start): checkout 02fb96d +``` +2. Select where to reset to, in our case its `2e6c386`, or `HEAD@{5}` +3. 'git reset --hard HEAD@{5}' this will reset your repo to that head +4. You can start the rebase again or leave it alone. + +[Additional Reading.](https://git-scm.com/docs/git-reflog) + ### revert Revert can be used to undo a commit. It should not be confused with reset which |