Tower
Tower

Reputation: 102755

How to "git log" the entire repository and not just the branch you are on?

The question is simple: I want to see the output of git log, but for the entire repository. Currently it just shows the changesets in the branch I am on: git log --all --source --graph.

For example, it would be perfect if I could see the last 100 commits in the repository no matter what branch I am on and what branches those commits belong to. Is this possible?

Upvotes: 10

Views: 3072

Answers (3)

Kit Ho
Kit Ho

Reputation: 26958

You can also use gitk --all to show all the commits, that what's you need as well.

Upvotes: 1

Emily
Emily

Reputation: 18193

Give this command a try:

git log --all --graph --decorate --pretty=oneline --abbrev-commit

You already had the right start with --all --graph. Adding in --decorate will show any branches or tags pointing to a commit, and the others two, --pretty=oneline --abbrev-commit are just to clean up and compact the output.

It's best to include the --pretty in the command, because --decorate won't work if you're using a custom format.

If this is a command you're going to use a lot, you can actually add an alias so it's easy to reuse without typing the whole thing out. For instance, add the following to your ~/.gitconfig:

[alias]
  history = "git log --all --graph --decorate --pretty=oneline --abbrev-commit"

Then you can just use git history to get the nicely formatted output.

Upvotes: 13

Noufal Ibrahim
Noufal Ibrahim

Reputation: 72735

I don't know if there's a single command to do this. Also, it can be quite confusing since the commits might get interleaved.

I wrote a little ruby script that prints something like this out but in a format suitable for graphviz's dot command to give me a graphical view of the repository history. You could try that. The script is fairly straightforward so you can modify it to print the same information (which is what you're looking for) in a linear format as well.

Upvotes: 0

Related Questions