where did my changes go?
where did my changes go?
cd commadir
git init
echo "dog" >> dog.txt
git add .
git commit -m one
echo "dog" >> dog.txt
git add .
git commit -m two
echo "dog" >> dog.txt
git log
git checkout dog.txt
cat dog.txt
how many dogs in dog.txt?
I can certainly understand the danger/confusion there, though. Using checkout on a file reverts the file to a committed state. But the grandparent was referring to checking out a branch, not a file, which is safe.
has the same behaviour. does it not? I left out the asterisk as I was working from memory.
Why would you think otherwise?
Ah, missed that -- and I concur with the other commenter that this is bad UI.
However, I don't think this qualifies as particularly dangerous or surprising behavior. You're explicitly giving a file name after all -- you had better read up on what the command does if you're doing that. ("rm X" is pretty good precedent.)
Does "checkout -- some-file" not add an entry to the reflog?
(Which, btw, is one of the most important and useful commands ever in the history of VCS.)
it's a learning curve alright.
git checkout <commit-hash> <filename>
working copy of filename now gone if not committed.
update, this is what i meant:
"git checkout * "
"git checkout <commit-hash> * "
"git checkout <branch> * "
each have the same warningless wipeout of uncommitted changes.