1. 24
  1.  

  2. 7

    this looks luxurious

    1. 5

      The git add -p family is what I use all the time.

      • git add -p - add chunks interactively
      • git commit -p - add hunks interactively, then commit staged & added chunks.
      • git reset -p - reset interactively
      • git checkout -p - checkout interactively.

      Instead of going through history, I end up thinking about each of the changes I’ve made as having a theme. As a result, my flow looks like this, in a day-to-day:

      • git commit -p -v (commit many small chunks, until tests pass)
      • git fetch && git rebase origin/master
      • If you can squash all “fixup” commits easily, use git rebase -i origin/master to do that, then merge.
      • git reset --soft origin/master, then use git commit -p to slowly add each incremental change as it’s own commit.
      1. 3

        I like it when things make sense, and this makes sense in approach and in effect.

        1. 3

          Related repo:

          More distal but similar:

          1. 2

            Mercurial is my git alias, via hg-git. Kinda funny that we already have commands in hg like branch to make a branch and branches to list them (same with tags and bookmarks), as well as uncommit and amend commands.

            1. 1

              +1 here. Only small downside is .hg directory contains both hg and git repositories

            2. 1

              I think this is a good approach to thinking about aliases - don’t just add shorter nicknames, instead use meaningful new terms - that said, since using magit in emacs, I haven’t bothered with git aliases.

              Magit has basically the same approach I just described - the c-e comand (‘[c]ommit->[e]xtend’) is easier for me to remember than ‘commit –amend –no-edit’, and is basically the same alias I’d use if I was using the shell and I set up my aliases on a smart day.