summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git_commands/stash.go
diff options
context:
space:
mode:
authorLuka Markušić <luka.markusic@microblink.com>2022-04-08 11:32:23 +0200
committerLuka Markušić <luka.markusic@microblink.com>2022-04-10 09:35:59 +0200
commit6f7038c8277f82c32d2c23502f94fdf675ad07e1 (patch)
treebd91c9fab2ec10f613d93360df04df08065c6eef /pkg/commands/git_commands/stash.go
parent58ed23a47adbc4e0cef119c0f32adceaef28ff48 (diff)
Add option to stash only unstaged files
Diffstat (limited to 'pkg/commands/git_commands/stash.go')
-rw-r--r--pkg/commands/git_commands/stash.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/commands/git_commands/stash.go b/pkg/commands/git_commands/stash.go
index d20024aa9..26460bfa0 100644
--- a/pkg/commands/git_commands/stash.go
+++ b/pkg/commands/git_commands/stash.go
@@ -49,6 +49,10 @@ func (self *StashCommands) ShowStashEntryCmdObj(index int) oscommands.ICmdObj {
return self.cmd.New(cmdStr).DontLog()
}
+func (self *StashCommands) StashAndKeepIndex(message string) error {
+ return self.cmd.New(fmt.Sprintf("git stash save %s --keep-index", self.cmd.Quote(message))).Run()
+}
+
// SaveStagedChanges stashes only the currently staged changes. This takes a few steps
// shoutouts to Joe on https://stackoverflow.com/questions/14759748/stashing-only-staged-changes-in-git-is-it-possible
func (self *StashCommands) SaveStagedChanges(message string) error {