Hacker News new | ask | show | jobs
by martco 5255 days ago
I agree with the author that learning and becoming handy with git cli is very important.

I don't agree that you should stop using a GUI for git, especially if you've already cut your teeth on the command line. Tower, a git GUI for Mac OS X, has a great interface and ties in very well with the core git functionality. I've learned a lot about stashing, merge conflict resolution, and cherry-picking, thanks to that app. Also, Tower shows a tree graph, similar to the network diagram the author "seriously cannot live without."

Why knock visual tools when when you rely on them so much?

2 comments

I used git at the command line for two years before trying (and later buying) Tower.

I am a very visual person. It gives me greater confidence in what I'm doing when I can see a polished visual overview, it makes me more willing to use powerful features like picking individual lines to commit, to avoid any single commit containing a mixture of use cases.

But I always make sure I know what the GUI is doing on the command line before trusting it to be doing the right thing. I made sure I understood rebasing correctly before setting it to be the default pull behaviour in Tower. Similarly, I never feel comfortable using a one-line deployment script before running through a deployment by hand first.

Any tool that makes our lives easier and less likely to make silly screwups is a good thing in my eyes. It doesn't matter whether that tool is a GUI or a script. I prefer using a GUI for databases too, because the command line is woefully inadequate at letting me grasp the shape of data quickly.

I've tried a number of gui tools for git but I keep coming back to the command line. You can format your `git log` output to give you your network graph and `git add -[pi]` allow me to stage hunks of diffs much like a GUI tool might.

I think more than what tools you use (gui or command line) it's really useful to get an understanding of gits internal model. It informs day-to-day use and is a great example of an elegant, well-designed system.

You can format your `git log` output to give you your network graph...

Really? Awesome. How?

This is the alias I use in my `.gitconfig` for running log with graphical output (got this somewhere, not sure where):

    [alias]
      l = log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%an]%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
The omglog gem is also useful for working with git. It gives you a graphical log of the entire repo (not just your current branch as a normal git log does), and it auto updates by monitoring for file system changes (OSX only).

To install:

    sudo gem install omglog
Then just run `omglog` in the root of your repo, or use this alias in your `.gitconfig` to automatically run it from the root of whatever repo you're in:

    [alias]
        omg = !omglog
(shell commands, starting with a "!" command in a git alias are always run from the root of a repository)
Stick this in your ~/.gitconfig

[alias]

  lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %C(bold white)%s%Creset %Cgreen(%cr) %C(blue)@%an%Creset' --abbrev-commit --date=relative
Then use from the cli as `git lg [branch1, branch2...]

Sourced from multiple results on google and customizations over time.