Add git stash command
Current state of thought. Thanks to comment on:
- default mappings
- behaviors
- missing commands
In vimagit buffer, stage your files/hunks/lines/part of lines as before. Once all your stuff you want to stash is in Stage section, use new mapping CS to enter in mode Stash. It is like the Commit mode, a new section "Stash message" appears on top on vimagit buffer. Enter a stash message (if not, it is like a git stash command without command, the message will be like WIP on branch..). Retype CS, your stage section is now stashed.
The main corner case detected for now is to handle wisely untracked files.
Personally, whenever I use git stash, I want to stash every file that's changed. I.e. a shortcut for "stash everything" would be nice.
I have the same request for commit. The real challenge is to find a mapping for that, even two mappings:
- stash everything modified
- stash everything modified + untracked
How about mimicking Vim's convention about doing things to a whole line, i.e. repeating the operation key (I'm thinking about 'dd' and 'cc' here). In this case that would mean
-
CAAto commit everything (fromcommit -a. The unfortunate thing here is thatCAdoes something different -
CSSto stash everything.CSSUcould be used to also stash untracked files.
I tend to avoid mapping overlap. If I set CSS and CSSU, the common command would IMO be CSS. But the command won't be immediate, as vim will wait for a possible U for CSSU.
True. CSU would avoid that.