DEV Community

Discussion on: My Mac Setup

Collapse
 
jameswilson profile image
James Wilson • Edited

Late to the party here, but have two small contributions to add:

  1. Your glog alias looks very similar to something I came up with that I named git tree and git tree --all that show a nicely styled git graph, tweaked and colorized for the most relevant info.

    => Screenshot of output from git tree

    I use this literally 10s of times a day as primary developer, and release manager on a wide array of projects for work.

    Also, I'd point out that instead of putting this in a shell-specific aliases file, I place these kinds of git-specific configurations inside ~/.gitconfig and then can easily scp the file to any server environment that has git installed.

    # in ~/.gitconfig
    [alias]
    
    # Change directory to repo root
    repo-root = "!cd $(git rev-parse --show-cdup)"
    
    # Display the commit history of current branch in a tree format, with color. 
    # Use git tree --all to see entire repo instead of current branch.
    tree  =  "!git log --graph --decorate --pretty=format:'%C(yellow)%h %Cred%ad %Cblue(%an)%C(cyan)%d%Creset %s' --date=format:'%F %k:%M:%S'  --abbrev-commit"
    
    # Show recent commits, similar to git tree, but with different contextual information
    recent = "!git log --color --format='format:%C(auto)%h %Cred%<(8,trunc)%aN  %Cblue%<(12)%ar %Creset%s'"
    
    # Show the merge history on the current branch.
    mh = "!git log --decorate=short --pretty=format:'%C(yellow) %h %C(blue) %s %C(reset)(%C(red)by %cN %C(green)on %cD%C(reset))' --merges"
    
    # Sometimes the only change in a file is from 0755 to 0644 or
    # vice versa; the following command resets all file permissions
    # changes to their original values.
    permission-reset = "!git diff -p | grep -E \"^(diff|old mode|new mode)\" | sed -e \"s/^old/NEW/;s/^new/old/;s/^NEW/new/\" | git apply"
    
  2. When I need something a bit more powerful than git tree to view the git graph interactively I use gitUp (free and open source). ProTip: this tool is also really useful as a replacement for git add/checkout -p to interactively stage or discard hunks across a large number of files with mouse-click-n-drag, then Enter key to stage or Delete key to discard.

    To open gitup for the current repository from the command line just type gitup from inside any folder in a repository, which launches via a symlink at /usr/local/bin/gitup that points to /Applications/GitUp.app/Contents/SharedSupport/gitup

Collapse
 
nickytonline profile image
Nick Taylor

Thanks for sharing those tips James. Gonna check gitup out.