What is objects/17 git directory?


Can anyone explain that purpose of objects/17 directory inside .git directory?


1 answer

1 accepted

1 vote
Answer accepted

Each 'git commit'

  • creates a unique commit Id (160-bit SHA-1 hash - calculated from the contents of the commit)
  • stores its data within the folder .git/objects within subfolders

==> The subfolders are created from the first two characters of your current commit-ID. The files within the subfolders are named from the rest of your commit-ID

This splitting is probably done to avoid thousands of files within a single folder.



Your commitID is 17556a21ebc68ce39bb53f26af9a590eb76d8c46

-> corresponding data is stored within .git/objects/17/556a21ebc68ce39bb53f26af9a590eb76d8c46




Bitbucket server code (GC scheduler) used exactly objects/17 dir. This is some of special directory i guess, but i can't find any docs about this directory.

And, yes, i know that is two first symbols from commit hash. My question is little bit another smile

Bitbucket Server checks how many loose objects there are in the 17 directory to decide whether a gc needs to be run. The assumption is that loose objects should be reasonably evenly distributed across the different object directories, so the count in 17 is a reasonable indicator. There's nothing special about 17 though..


If directory does not exists will GC never executed?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

265 views 0 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you