Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the .git folder not contain?

Tags:

git

From the git site (emphasis mine):

When you run git init in a new or existing directory, Git creates the .git directory, which is where almost everything that Git stores and manipulates is located. If you want to back up or clone your repository, copying this single directory elsewhere gives you nearly everything you need.

They sneak "almost" and "nearly" in there without elaborating. What isn't located in the .git directory? If I want to back up or clone my repository, what does copying that single directory elsewhere not give me?

like image 337
Tyler Avatar asked May 02 '15 18:05

Tyler


People also ask

What does the .git folder contain?

The . git folder contains all information that is necessary for the project and all information relating commits, remote repository address, etc. It also contains a log that stores the commit history. This log can help you to roll back to the desired version of the code.

What do I do with a .git folder?

A . git folder is required to log every commit history and every other information required for your remote repository, version control, commits etc. These things are saved in different folders which have different meanings. Once the folder is created, open it and see the contents of the folder.

Are .git files hidden?

The . git folder is hidden to prevent accidental deletion or modification of the folder. The version history of the code base will be lost if this folder is deleted. This means, we will not be able to rollback changes made to the code in future.


1 Answers

Git does not record:

  • file groups
  • file owners
  • file permissions (other than "is this executable")
  • extended attributes
  • empty folders
  • (anything in .gitignore, but that's probably desired)
  • gitmodules

Probably this post can provide you more insights

like image 107
Maze Avatar answered Nov 02 '22 02:11

Maze