diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-09-30 10:33:15 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-09-30 10:33:15 -0700 |
commit | 0a1283bc3955a97557019d077b96669c5c93c551 (patch) | |
tree | 41ed428d09777498b371149e40f10ef628444a87 /t/t5560-http-backend-noserver.sh | |
parent | Git 1.7.4 (diff) | |
download | tgif-0a1283bc3955a97557019d077b96669c5c93c551.tar.xz |
checkout $tree $path: do not clobber local changes in $path not in $tree
Checking paths out of a tree is (currently) defined to do:
- Grab the paths from the named tree that match the given pathspec,
and add them to the index;
- Check out the contents from the index for paths that match the
pathspec to the working tree; and while at it
- If the given pathspec did not match anything, suspect a typo from the
command line and error out without updating the index nor the working
tree.
Suppose that the branch you are working on has dir/myfile, and the "other"
branch has dir/other but not dir/myfile. Further imagine that you have
either modified or removed dir/myfile in your working tree, but you have
not run "git add dir/myfile" or "git rm dir/myfile" to tell Git about your
local change. Running
$ git checkout other dir
would add dir/other to the index with the contents taken out of the
"other" branch, and check out the paths from the index that match the
pathspec "dir", namely, "dir/other" and "dir/myfile", overwriting your
local changes to "dir/myfile", even though "other" branch does not even
know about that file.
Fix it by updating the working tree only with the index entries that
was read from the "other" tree.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5560-http-backend-noserver.sh')
0 files changed, 0 insertions, 0 deletions