Re: Suggestion: make git checkout safer
- From
Kevin Daudt <me@ikke.info>
- Date
- Jun 3, 2015, 19:47 UTC
- Message-ID
- <20150603194756.GB29730@vps892.directvps.nl>
- In-Reply-To
- <loom.20150603T114527-151@post.gmane.org>
On Wed, Jun 03, 2015 at 09:55:05AM +0000, Ed Avis wrote:
> Jeff King <peff <at> peff.net> writes: >
Show 7 quoted lines
> If my personal experience is anything to go by, newcomers may fall into the > habit of running 'git checkout .' to restore missing files. In the old days > I would often delete a file and then run 'cvs update' or 'svn update' to > restore it. That would fetch a fresh copy from the repository, and while > it might do some kind of diff/patch operation on modified files, it would > not simply throw away local changes. >
The problem with these kinds of habbits is that they easily extend to the --force variant. If people execute git checkout . as a habbit without thinking, they will soon train to do git checkout -f . without thinking, and then you still have the same problem.
I do share your sentiment that it's easy to loose uncomitted changes to git checkout <path>, but like Jeff said, the entire goal of this command is to reset specific files from the index or commits.
Introducing a way to undo this would be a much better option to me then adding an extra switch with no way to undo.