Linked Questions
18 questions linked to/from What is the internal format of a Git tree object?
2068
votes
31
answers
1.5m
views
How do I clone a subdirectory only of a Git repository?
I have my Git repository which, at the root, has two subdirectories:
/finisht
/static
When this was in SVN, /finisht was checked out in one place, while /static was checked out elsewhere, like so:
...
92
votes
22
answers
81k
views
How to DEFLATE with a command line tool to extract a git object?
I'm looking for a command line wrapper for the DEFLATE algorithm.
I have a file (git blob) that is compressed using DEFLATE, and I want to uncompress it. The gzip command does not seem to have an ...
143
votes
7
answers
53k
views
How does Git compute file hashes?
The SHA1 hashes stored in the tree objects (as returned by git ls-tree) do not match the SHA1 hashes of the file content (as returned by sha1sum):
$ git cat-file blob ...
74
votes
3
answers
56k
views
How is the Git hash calculated?
I'm trying to understand how Git calculates the hash of refs.
$ git ls-remote https://github.com/git/git
....
29932f3915935d773dc8d52c292cadd81c81071d refs/tags/v2.4.2
...
33
votes
7
answers
22k
views
How to compute the git hash-object of a directory?
Does anyone have an example of using git hash-object on a directory? It works easily enough on a file* but doesn't work as I'd expect for a directory**
*: git hash-object c:\somefile.txt
**: git ...
27
votes
4
answers
19k
views
What is the file format of a git commit object data structure?
Context: I was hoping to be able to search through my git commit messages and commits without having to go through the puzzlingly complex git grep command, so I decided to see how git commit messages ...
12
votes
3
answers
6k
views
Git/GitKraken – File Mode changes to unknown value (14001) after restoring repo from backup
Still new to Git(Kraken). Had a logic board go bad on me, and had to restore a repo from a backup, reinstall software, and get back up and running on a temporary machine till I can get the original ...
6
votes
3
answers
4k
views
Where are tree hashes stored in git?
I am following this tutorial (https://jwiegley.github.io/git-from-the-bottom-up/1-Repository/3-blobs-are-stored-in-trees.html) to learn about git architecture.
The command
$ git cat-file commit HEAD
...
6
votes
2
answers
2k
views
How does Git store tree objects?
I'm trying to understand the exact format for how git stores tree objects. How is the hash of a tree object calculated?
8
votes
1
answer
4k
views
How do I unpack a single git object?
In an answer to a question about the internal format of git’s tree objects, to get to one particular tree object that was stored in a pack, I unpacked all of the objects in a repository’s packfiles ...
0
votes
0
answers
3k
views
fatal: bad tree object. Is manual recreation of the missing tree the only option in this case?
I've been work on this project locally from the late December of 2018.
Now decided to push it to the remote on Github.
When I ran git push -u <REMOTE_NAME> master I got the message:
fatal: bad ...
1
vote
3
answers
375
views
Assigning git's SHA of a directory without git
So, I found this question:
How to assign a Git SHA1's to a file without Git?
but I am unsure how to do this method for a directory. How can I hash a directory in a program without using git so ...
4
votes
1
answer
1k
views
How can I print the contents of a Git object as it is stored in the .git folder?
The following commands do not produce the same output:
cat .git/objects/96/d0745960850e8ac97406311f3288b6d035cefc
git show --raw 96d0745960850e8ac97406311f3288b6d035cefc
I have tried various options ...
0
votes
2
answers
668
views
How to inflate a git tree object?
I'm doing some Java classes to read informations from Git object. Every class works in the same way: the file is retrieved using the repo path and the hash, then it is opened, inflated and read a line ...
4
votes
1
answer
197
views
Why don’t git tree objects encode SHA-1 hashes the same way as commits and tags?
Given a simple repository
$ touch empty ; git add empty ; git commit -m 'My commit'
[master (root-commit) e9cc922] My commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 empty
...