Extracting a file

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

 



Hi,

sometimes there is a need to extract a file from a commit.
E.g. some changes have been applied to it in the work directory,
and the app being implemented no longer works properly.
It would be fine to have a look at that file, some commits ago,
when all worked fine.
Of course, it is possible to recover the entire old commit, or to
make a new branch, or checkout the file (which requires to save
the new one before), but the most simple and safe way is to
extract the file, giving it a new name.
That is possible, using this (hard to remember) trick:

git show HASH:file/path/name.ext > some_new_name.ext

Would not be better to have a "copy" command to copy a file from a commit
to a new one in the current directory?
This would make a git repository resemble a (readonly) filesystem, which
actually it is.
Note also that the ability to get from a repository what one has stored
in it is the most basic feature anyone wants from a repository.

Thank you
-Angelo Borsotti



[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