0

There are many times where I have one project bring another repository in as a subtree. This is great and works fine, but it complicates git-log because I end up seeing this unbelievably-long history associated with the subtree and it's placed above the history of my branch, making it much harder to see what's going on in my branch/master/etc.

Is there a way to tell git-log to ignore all commits reachable by a certain commit? I'm thinking of making a project-specific pretty-log script that knows some of the commit IDs of the things subtree'd-in so I can have it automatically filter those out and show me a more-useful git-log.

isherwood
  • 58,414
  • 16
  • 114
  • 157
iAdjunct
  • 2,739
  • 1
  • 18
  • 27
  • You can ignore that subdirectory: https://stackoverflow.com/questions/5685007/making-git-log-ignore-changes-for-certain-paths – Chris Maes Mar 24 '21 at 12:56
  • 2
    Have you read the [documentation of `git log`](https://git-scm.com/docs/git-log)? The answer to your question is exposed in the second paragraph. – axiac Mar 24 '21 at 13:16
  • ... I had not ... and, in hindsight, should have. – iAdjunct Mar 24 '21 at 14:09

1 Answers1

1

In your situation with a subtree : @ChrisMaes comment linking to how to ignore a directory is a good suggestion.


Yes, you tell git log to ignore a commit and its parent.

Quoting git help log :

Thus, the following command:

$ git log foo bar ^baz

means "list all the commits which are reachable from foo or bar, but not from baz".


At the end of the "Description" paragraph of git help log, you can read :

The command takes options applicable to the git-rev-list command to control what is shown and how [...]

git-rev-list will tell you all the details of how you can describe a set of commits.

LeGEC
  • 46,477
  • 5
  • 57
  • 104