- GIT is a free and opensource distributed version control system.
- A version control system is a tool that lets you track the history and attribution of your project files over time.
- This helps the developers in the team to work together.
- Each developer has his own sandbox,preventing their work in progress from conflicting.
- A mechanism is provided to merge the changes and synchronize work.
- Each developer has his own copy of project history, a clone of repository.
- Nearly all operations are performed locally and are flexible.
- Repository's meant for development also provide a separate working area(a Work Tree) with project files for each developer.
- Branching model used by GIT enables local branching and flexible branch publishing allowing to use branches for context switching and for sand boxing different work in progress.
- Allows long term undo,rewinding back to last working version.
- Ownership tracking makes it possible to find out who was responsible for any given area of code.
- Compare different revisions go back to revision and debug the same.
- Find out which revision introduced a regression bug.
- GIT maintains a ref log for each and every change.
- GIT is distributed version control system.
Distributed Vs Centralized Repositories
- Centralized models require a network connection to a centralized server.
- You make a change to your project and then commit that change which is sent to centralized server to track.
- Other developers can immediately access the changes.
- In Distributed model we commit the code to our local private repository without having to talk to centralized server,removing the need to be connected to a network to make a change.
- Each developer has 2 repositories a private and a public repository.
- Private repository exist on our computer that we make commit too.
- Public repositories are those where we share our changes with other developers.
- Multiple developers may push changes to same public repository or each developer may have his own public repository.
- One can push and pull from multiple repositories.
- Centralized Version Control Systems has the benefit of having one system that provides revision numbers.
- Since everyone shares code in same repository.The repository can control what number it assigns to a particular commit.
- In a Decentralized system we use commit ID's that are SHA-1 hashes.
- The hash is based on the code what came before it, who made the commit when they made it and some more meta data.
- This lowers the chances of repeated commit ID's.
- Forking is a process where a concerned part of Project is separated and provided to developer to work upon and then later merge the same back to original Project.
- GIT uses super merging capabilities, rooted in its distributed nature makes merging changes in a forked repository easy.
- A user may fork a repository, commit changes and ask the original developer to pull your changes through a pull request.
- The more the forks are the more active is the community working on a project.
- A GIT user fetches code from all the other developers and commits the changes it has made to the code.
- Break out GIT's patch mode,stage and finally commit each set of changes separately.
- Once a feature is complete combine the commits that are logically related and push them to the public repository for rest of the team to pull.
- Each team member makes changes in its private repository.
- The member can then share the changes with other developers by pushing them back to the public repository shared by all.
- Here no forking is there so we can use GIT as a traditional version control system as well.
- If someone else has shared changes in shared repository that one is not updated with it will give an error during pushing changes.
- One must first update the changes from the shared repository and integrate them into your private repository via process called merging.
- Once the changes are merged one can push changes to share with rest of the team.
Repository Layouts
Public repositories can be managed in 2 ways
- In a distributed model each developer has his own public repository that the developer uses to publish their changes too.
- All the other developers can pull changes from everyone else's repositories to keep current.
- There is a lead developer who is responsible for making sure all changes are integrated.Thus limiting the number of repositories one has to pull from.
- Only one person can push changes to main repository.He/She is responsible for merging changes from all contributors into the main repository.
- Many encourage forking out the project.So that other members can review their changes.If accepted one of the main contributors merges them back to the project's repository.
- In a shared repository model all developers can push to a shared repository.This resembles the shared centralized model.
- Many Projects have main repository open for all other committers.
- A mix of both of these where each developer maintains their own public repository for sharing code that is still a Work in Progress.There is also a shared repository for all the code that's ready for production.
![]() |
| Distributed Repository |



Comments
Post a Comment