Re: Manually decoding a git object
- From
徐迪 <xudifsd@gmail.com>
- Date
- Feb 20, 2012, 04:45 UTC
- Message-ID
- <CAMocUqRNNXpGOJ2ZG8bWpkieKkVfoo0=Lkevjw+E3Tssw68Hwg@mail.gmail.com>
- In-Reply-To
- <A716A27D407F401DAAC373027D5CFF2A@PhilipOakley>
2012/2/20 Philip Oakley <philipoakley@iee.org>:
> If I have a renamed file which is a git object, such a "Git_Object", was > 8c-something-or-other, what is the easiest way of examining / decoding / > recreating the original file (either as its sha1, or a cat-file). >
I don't think I fully understood what you mean, I assume you just move an object file from $GIT_DIR/objects/ to somewhere and rename it, let's call it "obj", so if you want to exam its content you can just simply call "git cat-file -p obj". And you can also use "git cat-file -t obj" to exam its object type. If it's a blob you can use "git cat-file -p obj > original" to recreate it, else it's meaningless to recreate it.