This is something a bit like git-add -i, except not depending on perl, and partially crossed with git-commit. Usage: $0 [file [file ...]] Runs git diff with the same arguments. Any non-text diffs, new files, or deleted files cause an immediate error out. Text diffs are accumulated; each diff hunk is remembered separately. The user interface allows the user to, repeatedly, choose from: - Quit. - Commit what's staged (by running git-commit). - Choose a diff hunk to be included. - Stage the files corresponding to the chosen hunks. - Show diffs from HEAD to the index. The working files are temporarily replaced during a "stage the files..." operation, because I know of no way to stage content under a given name without having that content present in the file with that name. (This is probably possible, but I suspect it means not just using plumbing but actually going under the hood of the plumbing; this would be a reasonable thing for git update-index to be capable of, but if it is it's not clear how. --cacheinfo looks like part of it, but it leaves unanswered the question of how to create an object for given file contents. git apply --cached is a `so close but yet so far'.) When replacing the working files, the originals are saved under temporary names. They are saved by renaming, so as to preserve things like ctimes and inumbers.