All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dirk Süsserott" <newsletter@dirk.my1.cc>
To: Holger Hellmuth <hellmuth@ira.uka.de>
Cc: "René Doß" <doss@gmx.de>, git@vger.kernel.org
Subject: Re: checkout on an empty directory fails
Date: Thu, 05 Jan 2012 20:33:25 +0100	[thread overview]
Message-ID: <4F05FB05.3090706@dirk.my1.cc> (raw)
In-Reply-To: <4F05ACD6.6040603@ira.uka.de>

Am 05.01.2012 14:59 schrieb Holger Hellmuth:
> On 05.01.2012 13:38, René Doß wrote:
>> git status says not special informations.
> 
>  versus
> 
>> red@linux-nrd1:~/iso/a> git status
>> # On branch master
>> # Changed but not updated:
>> # (use "git add/rm <file>..." to update what will be committed)
>> # (use "git checkout -- <file>..." to discard changes in working
>> directory)
>> #
>> # deleted: SP601_RevC_annotated_master_ucf_8-28-09.ucf
>> # deleted: rtl/ether_speed.vhd
>> # deleted: rtl/ether_top.vhd
>> # deleted: rtl/ether_tx.vhd
>> # deleted: rtl/takt.vhd
>> # deleted: sim/makefile
>> # deleted: sim/tb_ether_top.vhd
>> #
> 
> This *is* special information: It tells you that master has those 7
> files but your working directory has none of them (i.e. it is as if you
> had deleted them from your working directory).
> 
> "git checkout <branch>" switches between branches, *but* leaves changes
> you made (files you edited, added or deleted) intact! This is so you can
> switch branches before commiting if you suddenly realize you are in the
> wrong branch.
> 
> "git checkout -- <paths...>" or in your case "git checkout -- ." is
> different, it really overwrites the files in your working dir with the
> versions stored somewhere else, by default from the index.
> 
>> What means the point in checkout?
> 
> "." is simply your current directory

Another way of reviving the deleted files and restore the master branch is

$ git checkout -f master # or git checkout --force master

This will unconditionally checkout master and overwrite the local
changes, including the deletions Holger mentioned.

For me, "checkout --force" is more intuitive than "reset --hard" or
"checkout .".

    Dirk

  reply	other threads:[~2012-01-05 19:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 10:09 checkout on an empty directory fails René Doß
2012-01-05 11:06 ` Nguyen Thai Ngoc Duy
2012-01-05 12:38   ` René Doß
2012-01-05 13:59     ` Holger Hellmuth
2012-01-05 19:33       ` Dirk Süsserott [this message]
2012-01-05 11:07 ` Ramkumar Ramachandra
2012-01-05 11:13 ` Thomas Rast

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F05FB05.3090706@dirk.my1.cc \
    --to=newsletter@dirk.my1.cc \
    --cc=doss@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=hellmuth@ira.uka.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.