2

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?

Ela
  • 3,142
  • 6
  • 25
  • 40

1 Answers1

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • is there no way of doing this directly? something of the lines +1? – Ela Aug 18 '15 at 15:19
  • 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