Checkout file without changing index?

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

 



Hi,

what is the standard/recommended way for updating a file to given version?

I was familiar with "git checkout revision -- file".

But it updates both working tree and index. I had some changes in
index (staged) and "git checkout HEAD -- file" silently overwritten
it. Well, probably my mistake, it's documented.

After searching a bit I found "git show revision:file > file". But
it's problematic:
1. works only for 1 file. "git show revision -- file" does something else
2. requires full path, so you need to specify "git show
revision:relative/to/top/dir/file"

If there's no other easy way, maybe we could add "--no-index" to
checkout: "git checkout --no-index revision -- file" (or similar -
maybe use options from git-reset).

My use case: I had some changes prepared in index and wanted to
compare the prepared version with some older version. The file was a
zip file plus we use LFS so there was no other way than to "checkout"
the file, unpack it and diff it.

-- 
Piotr Krukowiecki



[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]

  Powered by Linux