aboutsummaryrefslogtreecommitdiffstats
path: root/worktree.go
diff options
context:
space:
mode:
authorLinuxer Wang <linuxerwang@gmail.com>2019-05-03 09:46:54 -0700
committerLinuxer Wang <linuxerwang@gmail.com>2019-05-15 23:02:27 -0700
commitd1e34a7675bf8bb95f3c40c27d446adc5862eb62 (patch)
tree53bfb94ef1a2ed250b9edc60f803d6066314e29a /worktree.go
parent24de5efe77a202ddba83abb4d14095474dcdf1f6 (diff)
downloadgo-git-d1e34a7675bf8bb95f3c40c27d446adc5862eb62.tar.gz
Keep local changes when checkout branch in worktree.
Signed-off-by: Linuxer Wang <linuxerwang@gmail.com>
Diffstat (limited to 'worktree.go')
-rw-r--r--worktree.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/worktree.go b/worktree.go
index dae40a3..1b10449 100644
--- a/worktree.go
+++ b/worktree.go
@@ -160,6 +160,8 @@ func (w *Worktree) Checkout(opts *CheckoutOptions) error {
ro := &ResetOptions{Commit: c, Mode: MergeReset}
if opts.Force {
ro.Mode = HardReset
+ } else if opts.Keep {
+ ro.Mode = SoftReset
}
if !opts.Hash.IsZero() && !opts.Create {