How to Stash Everything git commit Wouldn't Commit

Sometimes I want to take some changes that I’ve made but haven’t yet committed yet and put the into the git stash, which I probably use a lot more than I should. When will you learn to just git commit -mwip, Caleb?

Either way, Git has my back. git stash --keep-index --include-untracked is almost the opposite of the above. It creates a stash commit for only files that wouldn’t otherwise be committed: unstaged changes and untracked files.

The above command is really useful in cases when you want to make a commit of a subset of your working tree. Say you’ve set up the perfect commit and want to run your tests to be sure that it works or you’re about to switch branches but want to take some changes with you.

It occurs to me that this would be a good alias. Maybe I’ll run

git config --global alias.reverse-commit "stash --keep-index --include-untracked"

Here’s where I get in trouble for oversimplifying but hopefully these are helpful definitions and not troublesome

There’s a fair bit of jargon here. Git is a very powerful tool that is really abstracted to too low a level for end-users, which is why so let me attempt to break it down.