18

When I check out a previous commit of a git repository, 'git log' no longer shows commits that were committed after the currently checked out commit.

So, the question is: how do get a log of commits after the currently checked out one?

PlankTon
  • 12,072
  • 14
  • 83
  • 149
  • 4
    Not really an answer, but I *highly* suggest using `gitk --all` to visualize multiple branches and history. – Irfy Feb 20 '12 at 13:25

2 Answers2

26

You can use the --all flag to see all revisions, as in

git log --all

If you are just interested in the future revisions, you can also use

git log ..@{1}      # assuming you just switched from the future master
git log ..abcdef    # assuming abcdef is the newest future commit
phihag
  • 263,143
  • 67
  • 432
  • 458
  • can you explain the `..@{1}`? – drzaus Nov 28 '14 at 19:48
  • @drzaus `@{n}` is the n-th commit in your current branch, so `@{1}` is simply the newest commit in the current branch. The double-dot `..` indicates show everything reachable from the commit to the right that is not reachable from the commit to the left. Therefore, `HEAD..@{1}` shows everything that is reachable from the newest commit in the current branch but not the current commit (and `HEAD` can be left out). – phihag Nov 28 '14 at 21:39
3

The problem is: you don't know the children commits, only the parent comments.
And if you checkout directly a commit SHA1, you are in Detached HEAD mode (ie not on any branch).

One potential solution would be to list all the branches which contains your commit: "How to know which branch a “git log” commit belongs to?".
And then do a git log for each of those branches.

Community
  • 1
  • 1
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755