1. 23
  1.  

  2. 16

    See also: git commit -v

    1. 2

      I usually just run git diff in another tmux window, which seemed simpler than this article, but your suggestion is better still.

    2. 8

      Or just use magit in Emacs, which automatically shows you a diff in one buffer and you edit your commit message in another.

      1. 4

        Yeah, magit is my favorite tool in a long time - the support for viewing staged diff chunks and operating on them individually - including discarding them if they’re just e.g. debug prints - is pretty great.

        It’s also being improved regularly, for example I like the new command for starting a new branch and cleaning up the current branch (probably master) after you’ve already committed some things - magit-branch-spinoff, that’s not in the online docs yet: github.com/magit/magit/blob/master/Documentation/magit.org – search for spinoff

        1. 1

          Thanks for sharing about magit-branch-spinoff. That looks useful! I haven’t been tracking what the new features in magit are, perhaps I should!

      2. 3

        For Mercurial, I use this committemplate (hg help hgrc.committemplate):

        http://inversethought.com/hg/hgrc/file/09cb15cf398c/hgrc#l51

        The most interesting part is the last line of the template which shows the diff. That way, I have a full diff in the same place where I’m writing the commit message. I need to get around to writing an Emacs hg commit mode that will properly syntax highlight the diff, but the lack of colour hasn’t annoyed me enough to do this yet.

        1. 1

          Thanks Jordi! adds to hgrc

        2. 2

          VIM users can use YUNOCommit. This plugin will remind you to commit after 20 writes.

          1. 1

            I typically use git add -p which refreshes my mind of what code was updated and then can write out a quick git commit -m after that.

            1. 1

              I find -v much more convenient than tmux. I have the following aliases in my .bashrc is

              alias gc='git commit -v'
              alias gca='git commit -a -v'
              alias gcaa='git commit -a --amend -v'
              alias gcaaC='git commit -a --amend -C HEAD'