git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Suggestion: make git checkout safer
@ 2015-06-03  8:50 Ed Avis
  2015-06-03  9:06 ` Jeff King
  0 siblings, 1 reply; 28+ messages in thread
From: Ed Avis @ 2015-06-03  8:50 UTC (permalink / raw)
  To: git

Currently a plain 'git checkout .' will revert any local changes, e.g.

    % mkdir test
    % cd test
    % git init
    Initialized empty Git repository in /home/eda/test/.git/
    % echo hello >foo
    % git add foo
    % git commit -m.
    [master (root-commit) 34f6694] .
     1 file changed, 1 insertion(+)
     create mode 100644 foo
    % echo goodbye >foo
    % git checkout .
    % cat foo
    hello

I suggest this is dangerous and by default 'git checkout' should only alter
files which do not have local changes (as would be reported by 'git diff').
Only if --force is given should working tree differences be thrown away.

    % git --version
    git version 2.4.0

-- 
Ed Avis <eda@waniasset.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2015-06-05 18:47 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-03  8:50 Suggestion: make git checkout safer Ed Avis
2015-06-03  9:06 ` Jeff King
2015-06-03  9:21   ` Ed Avis
2015-06-03  9:35     ` Jeff King
2015-06-03  9:55       ` Ed Avis
2015-06-03 17:35         ` Junio C Hamano
2015-06-03 17:49           ` Randall S. Becker
2015-06-03 18:11             ` Junio C Hamano
2015-06-03 18:18               ` Randall S. Becker
2015-06-03 18:14             ` Stefan Beller
2015-06-04 10:47               ` Ed Avis
2015-06-04 11:02                 ` Ed Avis
2015-06-03 19:26         ` Torsten Bögershausen
2015-06-03 19:47         ` Kevin Daudt
2015-06-04 11:00           ` Ed Avis
2015-06-04 20:14             ` Torsten Bögershausen
2015-06-05  9:32               ` Ed Avis
2015-06-05 10:49                 ` Duy Nguyen
2015-06-05 17:44                 ` Eric Sunshine
2015-06-05 18:03                   ` Junio C Hamano
2015-06-05 18:46                     ` Ed Avis
2015-06-05 18:37                   ` Eric Sunshine
2015-06-03 20:12         ` Philip Oakley
2015-06-03 17:32       ` Junio C Hamano
2015-06-03 19:06         ` Jeff King
2015-06-03 19:24           ` Randall S. Becker
2015-06-03 21:29           ` Junio C Hamano
2015-06-04  9:01             ` John Szakmeister

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).