Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Saturday, June 13, 2015

Remote Repository vs Local Repository GIT

Remote Repository is the Central Location of the code. We can clone remote repo into a local repo and start working on local. This local can be synched from time to time with the remote repo. We can push changes from local to remote.

Local repository is the cloned copy of the remote repo. All Version control functions are applicable to the local repo. We can create branch on a local repo. This branch will not be visible to remote, neither will have the parent in the remote. Local branches can be merged with local if required and local in-turn can push the changes to remote.

Putting changes to remote
This is a multi-step process. First changes are moved to the staging area, which is then committed to local. The local is then pushed to remote. Thus we commit to local and not to remote.  git add and git commit are two commands for that.

Distributed Version Control System

Distributed Version Control System


Unlike CVS/SVN, Distributed Version Control System, does not hold the data at a central location. A central copy is kept but each user has a local copy of his/her own. This copy is an exact replica of the central server with required history.

This saves the time to go to-and-fro to the central server among other things. GIT is a Distributed Version Control System.


What is Version Control?

What is Version Control?


As the name suggests it is a mechanism to control the versions (older/current). Consider it like a database which stores the copy of the copy at various times in life (snapshots). It gives the difference between two snapshots in time. Also it helps to do development in parallel on the same codebase.

To make it simple, VCS (Version Control System) hold copies of the code at various times on life. Consider it just like a photo album which contains your pic at various times in life. You can readily compare two pics and see the change in height/weight/hair etc in two images. Same is VCS.



Benefits of Version Control?


1. Group Work

Imagine a world without VCS. You would be working on a shared excel file. Who writes what and what happens to the data, is unknown even to God. A maintenance nightmare. With VCS these maintenance issues are taken care of. All code, revisions, everything at a central location.

2. Versioning

With VCS we maintain the versions over the time. Old copy of the code can be retrieved at a later date. We can come to know who changed what and can restore the code in case of bad changes.