Re: Suggestion: make git checkout safer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 03, 2015 at 09:55:05AM +0000, Ed Avis wrote:
> Jeff King <peff <at> peff.net> writes:
> 
 
> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]