mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-24 16:20:08 +01:00
1a8fe69f7a
This commit is comprised of three changes; two stylistic and one grammatical error fix: 1. change "commit in the past" to "past commit", which flows better in the sentence 2. change "on which past commit you were before" to "which past commit you were on before". While both sentences are grammatical, the former is likely to confuse the reader momentarily because the "on" has to take a long and unexpected journey to land in between "were" and "before". 3. "your HEAD did point to" to "your HEAD has pointed to". This changes the tense to present perfect, which is correct in this circumstance. The commas in the description are technically ungrammatical, or would be judged so by some, but I like the tone they convey, so I left them.
26 lines
670 B
Text
26 lines
670 B
Text
title = Go back to where you were before
|
|
cards = checkout reflog
|
|
|
|
[description]
|
|
|
|
Say you were looking at something in the past, and then switched back to the main branch.
|
|
|
|
But then, you got reaaally distracted, and after your lunch break, you can't remember which past commit you were on before. How can you find out?
|
|
|
|
There's a convenient command that shows you all the places your HEAD has pointed to in the past:
|
|
|
|
git reflog
|
|
|
|
[setup]
|
|
|
|
for i in {1..10}; do
|
|
git commit --allow-empty -m $i
|
|
git branch $i
|
|
done
|
|
git checkout 3
|
|
git checkout main
|
|
|
|
[win]
|
|
|
|
# Find out where you've been before, and go back there!
|
|
test "$(git rev-parse HEAD)" = "$(git rev-parse 3)"
|