Theepana Govintharajah posted: " What is a Git Repository? A Git repository tracks and saves the history of all changes made to the files in a Git project. It saves this data in a directory called .git, also known as the repository folder. If you delete the .git/ folder, then you"
A Git repository tracks and saves the history of all changes made to the files in a Git project. It saves this data in a directory called .git, also known as the repository folder. If you delete the .git/ folder, then you delete your project's history.
Types of Git Repository
There are two types of Git repositories, based on user permissions:
Bare Repositories
Software development teams use bare repositories to share changes made by team members. Individual users aren't allowed to modify or create new versions of the repository.
No commits can be made in a bare repository. The changes made in projects cannot be tracked by a bare repository as it doesn't have a working tree. In other words, it has the index but lacks the actual working files.
Typically, a bare repository is used as a remote; we push changes from our working non-bare repository into a bare repository.
Non-Bare Repositories
Non-bare repositories are user-friendly.
With non-bare repositories, users can modify the existing repository and create new versions.
By default, the cloning process creates a non-bare repository (if any parameter is not specified during the clone operation).
File structure of the default repository (Non - bare repository)
As you can see, the .git folder contains all the required files for tracking the project folder. The default repository is always used for local repositories.
File structure of the barerepository
This is the exact same file structure of .git folder in non-bare repository.
It is important to note that all bare repositories have .git extension (E.g. notice BareRepo.git)
Why Bare repository exists? When people collaborate to work on a project, they need a central repository where all the tracked changes are stored and prevent any conflict between the versions of the project on other's computers.
The only possible operations on the Bare Repository are Pushing or Cloning.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.