git is capable of stashing of individual hunks.

With --patch, you can interactively select hunks from the diff between HEAD and the working tree to be stashed. The stash entry is constructed such that its index state is the same as the index state of your repository, and its worktree contains only the changes you selected interactively. The selected changes are then rolled back from your worktree. See the “Interactive Mode” section of git-add[1] to learn how to operate the --patch mode.

Is it possible to use it with magit frontend? Magit simplifies patch mode usage for staging spectacular. Could it do the same work for stashes?


You can stage whatever changes you want to stash and then call magit-stash-index (zi).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.