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.
https://github.com/tj/git-extras, lots of similar commands to those mentioned in post (e.g. git back for uncommit) with shell integration for tab completion
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.
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.
this looks luxurious
The
git add -pfamily is what I use all the time.git add -p- add chunks interactivelygit commit -p- add hunks interactively, then commit staged & added chunks.git reset -p- reset interactivelygit 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/mastergit rebase -i origin/masterto do that, then merge.git reset --soft origin/master, then usegit commit -pto slowly add each incremental change as it’s own commit.I like it when things make sense, and this makes sense in approach and in effect.
Related repo:
git backforuncommit) with shell integration for tab completionbinfor the kitchen sink https://github.com/tj/git-extras/tree/4.1.0/binMore distal but similar:
Mercurial is my git alias, via hg-git. Kinda funny that we already have commands in hg like
branchto make a branch andbranchesto list them (same with tags and bookmarks), as well asuncommitandamendcommands.+1 here. Only small downside is
.hgdirectory contains both hg and git repositoriesI 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.