GIT part-2 Concepts and architecture

Two-tree-architecture
Two-tree-architecture

Git uses three-tier tree architecture for its repository’s files and commits, which is very handy. The illustration (a) below shows a typical two-tier tree set up which other version control systems use. The working depository is a root folder, which you have set up on your computer too manage your files this is done through setting up a root folder navigating to it through the command line and then initialising it as a repository i.e. git – init

When we wish to receive files i.e. clone or fork a repository we check it out from the repository into our working repository or copy.
When we wish to make changes or send files to the repository we call it a commit.
The reason we have two different repositories is that the files don’t have to be the same when you make changes to your working copy, you save them and they are saved on your hard drive, both different copies are saved, and until you choose to…. You can commit those changes to the repository. If the repository is a shared one there can be many different people working on it.

Three-tree-architecture
Three-tree-architecture

Three Tree architecture

As I mentioned earlier Git uses a three-tier tree, which adds another area called a staging area. See illustration b) This allows us to have 10 different files in our working directory (for example) and allows us to prepare five which we wish to add to our staging index in preparation for a commit. When we are happy we commit those five files with a message to our repository where git will track it.
Conversely we can pull or checkout our files to our working directory or staging index. more often than not you will pull them straight to your working directory.

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.