The .git Directory

The .git Directory

If you haven’t explored the .git directory yet, it’s worth the hike. Do a cd .git in your local git repository that you’ve cloned from a remote repository and you should find something similar to this:

.git

A brief explanation of the various files and directories:

File/directory Type Value Meaning
config text file [See diagram] The configuration file for the local git repository
HEAD text file ref: refs/heads/master Lists a file to read that is the currentHEAD branch: git branch will show the branch that HEAD refers to as the current branch.
refs directory   Everything under the refs directory is references to a commit for a branch of some type (either a local branch or a remote tracking branch).
refs/heads directory   Files in the refs/heads directory are branch names. For example a file named refs/heads/master means a branch named master exists in the local repository. The contents of the file is the hash of the most recent commit on that branch.
refs/heads/master text file 6975b25be537f997c92490c7927cb6886fd5c49f The most recent commit on this branch (master)
refs/heads/v1 text file fd70e1d85320d12f230d8ff5e6056d86a775a6f3 The most recent commit on this branch (v1)
refs/remotes directory - Everything under the refs/remotesdirectory is references to a commit for a remote-tracking branch.
refs/remotes/origin directory - The remote tracking branches for the remote repository origin are stored in this directory.
refs/remotes/origin/master text file 6975b25be537f997c92490c7927cb6886fd5c49f The most recent commit on this branch. Note the hash is the same as inrefs/heads/master which means the user has merged the commits from this remote-tracking branch into the user’smaster branch.
refs/remotes/origin/v0 text file e018ab5fe997a56bffb39350543c017684cfd721 The most recent commit on this branch. Note the hash is the different than the hash in in refs/heads/v1 which means the user’s local v1 branch is behind the commit in the remote-tracking branch’sv1 branch. The user needs to merge the commits from this remote-tracking branch into the user’s v1 branch to catch up to the remote-tracking branch.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值