microsoft / microsoft/VFSForGit

`git restore` after `git cherry-pick -n` can leave GVFS in a bad state

Open
#1,855 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
474
Avg merge
2d 4h
Merged PRs (30d)
8

Description

  1. Use git cherry-pick -n to cherry-pick some changes to current branch, leaving them uncommitted
  2. Use git restore --staged to unstage the changes

Expected:
All the changes from the cherry-pick move from staged to unstaged in git status.

Actual:
Sometimes some changes disappear from git status.
The files still have the changed contents, but git no longer recognizes the files as being changed.

It's unclear so far whether cherry-pick -n is required or if manual changes with git add will also repro.

git checkout to another branch appears to properly reset the file contents. (I've heard others complain about situations where it did not, though I don't know if they were caused by this and I haven't repro'd that.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported sequence with git cherry-pick -n followed by git restore --staged, then compare git status with the files' actual contents. Investigate the conditions under which changed files disappear from status, including whether manual changes followed by git add reproduce it; done means all changes are consistently reported as unstaged.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.