Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to always show full-history in Git?

Tags:

git

I'm using Intellij and command-line Git and we have problems with not seeing commits because Git defaults to not showing "uninteresting" changes.

For example, if Developer "A" changes something and pushes the change, then Developer "B" changes it back to the way it was (before "A"'s change) and pushes that change, those commits would not show in the history because they would cancel each other out (at least this is the way it's been explained to me.) This makes it hard to find problems and leads to a lot of "Where'd my change go?"

Ideally both Intellij and command-line would show full history, all commits, including merges, every time, by default.

Anyone know the settings to accomplish this in .gitconfig?

EDIT: The following section is from the git-log documentation and explains what I mean by "uninteresting changes"

Default mode Simplifies the history to the simplest history explaining the final state of the tree. Simplest because it prunes some side branches if the end result is the same (i.e. merging branches with the same content) --full-history Same as the default mode, but does not prune some history.

like image 722
user3120173 Avatar asked Oct 01 '22 17:10

user3120173


1 Answers

To show full history with git log invoke it with the --sparse and --full-history switches.

--sparse

    All commits that are walked are included.

    Note that without --full-history, this still simplifies merges: if one of
    the parents is TREESAME, we follow only that one, so the other sides of the
    merge are never walked.

Note that there is no way to specify default flags for git commands so you will have to create an alias for your command line git use. I am not aware of IntelliJ supporting such setup for git log.

like image 196
mockinterface Avatar answered Oct 05 '22 22:10

mockinterface