Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature request: Allow to Stash by line, not just by Hunk #413
Interesting, I'll have to take a look at how it's done there. Right now you can get this feature by staging the parts you want to keep in your worktree, and then use "stash" with the "keep index" option.
That'll keep the stuff you've staged and the unstaged stuff will get stashed.
The analog is command-line git's "Testing partial commits" from
The "stash by line" thing is "add just first part to index". Basically, you stage the parts that you don't want stashed, and then stash with the "Keep Index" option checked in the stash dialog to do the "save all other changes to the stash" step.
Semantically, it's the inverse because we choose what you don't want to stash rather than what you want to stash, but we can accomplish the same end result.
The diff editor lets you stash by line. Select just the lines you want to keep (I usually just select a small unique subset in the line, it doesn't need to be the full line) and then hit "s" to stage the selected lines.
It would be kinda nice if
If you don't mind, want to bring this up on the Git mailing list? If there's consensus there that we can add a new option to
What do you think? Is the current inverse workflow good enough, or should we add a knob to
BTW I looked at git-gui and I couldn't find this feature. I don't think it exists -- the only feature it has is line-by-line staging, which we already have (cola's feature actually predates the one in git-gui). In any case, we'll probably get this feature first too (please test the forthcoming commit)