On Tue, 6 Sep 2011 04:22:00 -0700 (PDT)
tombert <tomb...@live.at> wrote:

> > > I perform some changes in several files, then I delete two files
> > > because I want to discard those changes.
> >
> > > rm myfile1.txt
> > > rm myfile2.txt
> >
> > > Is there a way of bringing back those files with knowing its name?
> >
> > > I could use "git checkout ." but this would discard changes in the
> > > other files ...
> >
> > git checkout -- myfile1.txt myfile2.txt
> >
> > Actually, this is what Git tells you do do when you run `git status`
> > so pay close attention to this output.
> >
> > Note that that `git checkout` encantation is what you should have
> > used in the first place instead of deleting the files.
> Hi and thx for the reply, actually I'am reading the docs and
> investigating ... so up now there is no harm.
> 
> But your solution I already knew. What I asked for was "... without
> knowing its name ..." and without discarding local modified files i.e.
> an equivalent to "cvs update".
Then `git checkout-index --all` appears to be the closest thing I have
managed to find.

Here I have two files in the HEAD, aaa.txt and bbb.txt,
now I delete aaa.txt and modify bbb.txt and run git-checkout-index:

C:\tmp\foo>git status
# On branch master
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working
# directory)
#
#       deleted:    aaa.txt
#       modified:   bbb.txt
#
no changes added to commit (use "git add" and/or "git commit -a")

C:\tmp\foo>git checkout-index --all
bbb.txt already exists, no checkout

C:\tmp\foo>git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working
# directory)
#
#       modified:   bbb.txt
#
no changes added to commit (use "git add" and/or "git commit -a")

It appears that for big checkouts, the "--quiet" option is convenient
as well.

P.S.
Please don't top-post.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.

Reply via email to