Tags
#git
Question
Using reflog

If you screw up a rebase, one option to start again is to go back to the commit (pre rebase). You can do this using reflog (which has the history of everything you've done for the last 90 days - this can be conﬁgured):

$git reflog  4a5cbb3 HEAD@{0}: rebase finished: returning to refs/heads/foo 4a5cbb3 HEAD@{1}: rebase: fixed such and such 904f7f0 HEAD@{2}: rebase: checkout upstream/master 3cbe20a HEAD@{3}: commit: fixed such and such ... You can see the commit before the rebase was HEAD@{3} (you can also checkout the hash): git checkout HEAD@{3}  Now you create a new branch / delete the old one / try the rebase again. You can also reset directly back to a point in your reflog, but only do this if you're 100% sure it's what you want to do: git reset --hard HEAD@{3} This will set your current git tree to match how it was at that point (See Undoing Changes). This can be used if you're temporarily seeing how well a branch works when rebased on another branch, but you don't want to keep the results. Tags #git Question Using reflog Answer ? Tags #git Question Using reflog Answer If you screw up a rebase, one option to start again is to go back to the commit (pre rebase). You can do this using reflog (which has the history of everything you've done for the last 90 days - this can be conﬁgured): $ git reflog

4a5cbb3 HEAD@{1}: rebase: fixed such and such

3cbe20a HEAD@{3}: commit: fixed such and such ...

You can see the commit before the rebase was HEAD@{3} (you can also checkout the hash):

git checkout HEAD@{3}

Now you create a new branch / delete the old one / try the rebase again. You can also reset directly back to a point in your reflog, but only do this if you're 100% sure it's what you want to do:

git reset --hard HEAD@{3} This will set your current git tree to match how it was at that point (See Undoing Changes).

This can be used if you're temporarily seeing how well a branch works when rebased on another branch, but you don't want to keep the results.

If you want to change selection, open document below and click on "Move attachment"

pdfs

• owner: cramer7575 - (no access) - GitNotesForProfessionals.pdf, p50
• owner: tekwizz123 - (no access) - GitNotesForProfessionals.pdf, p50

Summary

status measured difficulty not learned 37% [default] 0

No repetitions