vimagit icon indicating copy to clipboard operation
vimagit copied to clipboard

Add git stash command

Open jreybert opened this issue 8 years ago • 5 comments

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.

jreybert avatar Aug 07 '17 16:08 jreybert

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.

fpnick avatar Aug 08 '17 12:08 fpnick

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

jreybert avatar Aug 08 '17 12:08 jreybert

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

  • CAA to commit everything (from commit -a. The unfortunate thing here is that CA does something different
  • CSS to stash everything. CSSU could be used to also stash untracked files.

fpnick avatar Aug 08 '17 12:08 fpnick

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.

jreybert avatar Aug 08 '17 12:08 jreybert

True. CSU would avoid that.

fpnick avatar Aug 08 '17 12:08 fpnick