A tool for operating on your git index, without stashing. It is common to want to commit only part of your working directory, but also be sure that ea

cormacrelf / git index-exec.md

submited by
Style Pass
2021-06-09 05:00:09

A tool for operating on your git index, without stashing. It is common to want to commit only part of your working directory, but also be sure that each commit will compile if checked out, or has correctly formatted code. This tool checks out your current index to a temporary directory (stable for each unique git working dir PWD) and runs a shell snippet in it. It then takes any changes that command made, and applies them to the index.

Run a code formatter on the index. Ensures that a commit has correct code formatting. If you also run the code formatter on your working directory, you will see less noisy diffs.

I built this because I often find myself writing for slightly too long without committing, and wanting to commit it in smaller pieces. The existing workflows for git are not quite right:

A good tip for a small 'edit compile test loop' when working on the index is to use something like vim-fugitive's :Gdiffsplit where each save is written directly into the index.

Leave a Comment
Related Posts