Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Feature parity with git checkout: worktree.Checkout() will not keep local files #1144

Open
linuxerwang opened this issue May 3, 2019 · 0 comments

Comments

@linuxerwang
Copy link
Contributor

linuxerwang commented May 3, 2019

go-git has a feature parity with git on checkout. The following is from the git doc:

git checkout <branch>
To prepare for working on <branch>, switch to it by updating the index and the files in the working tree, 
and by pointing HEAD at the branch. Local modifications to the files in the working tree are kept, so that 
they can be committed to the <branch>.

While in go-git worktree.Checkout(), even if CheckoutOptions.Force is set to false, after checking out the local changes are thrown away. That said, the issue is that worktree.Checkout() doesn't provide an option to keep the local changes.

I suggest introduce a new option field (Keep) for this purpose. A pull request will be created later.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant