On Mon, Oct 21, 2019 at 01:56:11PM +0000, Derrick Stolee via GitGitGadget wrote:
Enabling sparse-checkout can remove modified files:
$ mkdir dir
$ touch foo dir/bar
$ git add .
$ git commit -m Initial
[master (root-commit) ecc81bd] Initial
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 dir/bar
create mode 100644 foo
$ echo changes >dir/bar
$ ~/src/git/git sparse-checkout init
error: Entry 'dir/bar' not uptodate. Cannot update sparse checkout.
error: failed to update index with new sparse-checkout paths
$ cat dir/bar
changes
So far so good, my changes are still there. Unfortunately, however:
$ git add -u
$ ~/src/git/git sparse-checkout init
$ echo $?
0
$ ls
foo
Uh-oh, my changes are gone.