Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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?

like image 333
Tower Avatar asked Oct 13 '11 17:10

Tower


2 Answers

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.

like image 66
Emily Avatar answered Oct 10 '22 12:10

Emily


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

like image 31
TheOneTeam Avatar answered Oct 10 '22 12:10

TheOneTeam