home | list info | list archive | date index | thread index

[SIGS-L3GO] Some git stuff

A few people at L3GO were asking for these git things.

Show everything, in graph form, including the diff, and merge

	graph = log --graph --decorate --all --patch --cc

No diff, oneline.

	logg = log --graph --decorate --all --oneline

Same as above, but with ISO 8601 timestamp.

	logd = log --graph --decorate --all --pretty='%C(auto)%h [%ai]%d %s'

--oneline is pretty much just without the " [%ai]".

Note that for the last three, you can also do stuff like this:

    git graph -SWiFi --author Alex Pilon --word-diff --word-diff-regex='\S' -w -- .profile.d

    # show all commits containing containing WiFi in the diff, by yours
    # truly, under the directory .profile.d. Also ignore whitespace, and
    # use a word diff format, to make trivial additions and deletions to
    # a line, especially when within a word (like within a function
    # name, or adding a sigil, trivially visible, unlike the
    # line-oriented format, or the naive word diff.

Yeah, that's a mouthful. Use a shell with decent auto-completion, and
have coworkers constantly throwing code your way that *warrants* this.
It only takes <2 seconds to type anyway, which is far less than it would
take for you to do in a GUI.

*Typically* last pull's commits, grouped by author, oneline.
See gitrevisions(7)

	changelog = shortlog @{1}..@

Traditional log format, last pull.

	lastlog   = log      @{1}..@ --date-order

Your branch's upstream. Only really useful if you're fetching instead of
pulling, and not all of us have workflows that require even having a
local, non-remote branch, that even has an upstream (think feature
branches and PRs).

	ustplog = log @{upstream}..

Branches merged into current one, so you can | xargs git branch -d.

	merged = branch --merged HEAD~

And if you're in the Linux kernel git repo,

    linlog = log @{1}..@{0} --author='Linus Torvalds'

you have any idea how many branches there are? Geez. You can't visualize
that, in any program, period. Not unless you're doing some sort of
branch collapsing (e.g., --merges, but that's only on merges, not
subsystem maintainers, etc).


Alex Pilon

P.S. Did you know that you can use git