When in detached mode in git, it is easy to see the older commits with git log
and so you can easily navigate to them. However how do you move to a more recent one?
Asked
Active
Viewed 69 times
2

Ela
- 3,142
- 6
- 25
- 40
-
Do you want to switch to one of previous commits? – neshkeev Aug 18 '15 at 14:18
-
If you know the commit hash you can checkout on it even though it's more recent than the state you are in – Raul Rene Aug 18 '15 at 14:35
1 Answers
2
You can list the branches that contain the commit referenced by the detached HEAD (say: <acommit>
)
git branch --contains <acommit>
Any git log <acommit>..<abranch>
would then list more recent commits.
-
-
1@Ela a commit can be part of multi branches. You need first to know which branch you want to consider, in order to know what +1 means. – VonC Aug 18 '15 at 15:20