Skip to main content
add "data structure" to title for better SEO
Link

What is the file format of a git commit object data structure?

edited title
Link

What is the file format of a git commit object?

Fix formatting and remove GitHub tag as this has nothing to do with GitHub
Source Link
John Szakmeister
  • 46.2k
  • 10
  • 91
  • 81

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 were stored.

I took a look in a .git folder, and it looks to me like commits are stored in

.git/objects 

The .git objects folder contains a bunch of folders with names like a6 and 9b. These folders each contain a file with a name that looks like a commit sha 2f29598814b07fea915514cfc4d05129967bf7. When I open one of those files in a text editor, I get gibberish.

  1. What file format is this gibberish / How is a git commit object stored?
    2.In

  2. In this git commit log, the folder 9b contains one commit sha

     aed8a9f773efb2f498f19c31f8603b6cb2a4bc
    

    aed8a9f773efb2f498f19c31f8603b6cb2a4bcWhy, and is there a case where more than one commit sha would be stored in the file 9b?

  3. is there a way to convert this gibberish into plain text so that I can mess with commits in a text editor?

Why, and is there a case where more than one commit sha would be stored in the file 9b?

  1. is there a way to convert this gibberish into plain text so that I can mess with commits in a text editor?

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 were stored.

I took a look in a .git folder, and it looks to me like commits are stored in

.git/objects 

The .git objects folder contains a bunch of folders with names like a6 and 9b. These folders each contain a file with a name that looks like a commit sha 2f29598814b07fea915514cfc4d05129967bf7. When I open one of those files in a text editor, I get gibberish.

  1. What file format is this gibberish / How is a git commit object stored?
    2.In this git commit log, the folder 9b contains one commit sha

    aed8a9f773efb2f498f19c31f8603b6cb2a4bc

Why, and is there a case where more than one commit sha would be stored in the file 9b?

  1. is there a way to convert this gibberish into plain text so that I can mess with commits in a text editor?

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 were stored.

I took a look in a .git folder, and it looks to me like commits are stored in

.git/objects 

The .git objects folder contains a bunch of folders with names like a6 and 9b. These folders each contain a file with a name that looks like a commit sha 2f29598814b07fea915514cfc4d05129967bf7. When I open one of those files in a text editor, I get gibberish.

  1. What file format is this gibberish / How is a git commit object stored?

  2. In this git commit log, the folder 9b contains one commit sha

     aed8a9f773efb2f498f19c31f8603b6cb2a4bc
    

    Why, and is there a case where more than one commit sha would be stored in the file 9b?

  3. is there a way to convert this gibberish into plain text so that I can mess with commits in a text editor?

Source Link
Tara Roys
  • 1.8k
  • 2
  • 19
  • 31
Loading