Introduction to Git

Version control system

As a programmer we all know about version control system. This is a very important tool in our daily life. It behaves like a time machine. Version control system holds all your change histories of your codebase. You can commit your code in version control system. You can also check history from version control system about what are the changes are made in past in your codebase. You can compare changes made to a particular file. Version control system works best with text based files. You can find more than one version control systems in software industry. The most popular are SVN, TFS, and Git.

Types of version control system

In respect to developer work flow, there are two types of version control systems:

  1. Checkout – edit – checkin process: You need to first checkout a file and work with that. While you are making changes in that file, others cannot change that file content. In that time you have a write lock on that file. After you have done with your changes you can checkin the file and release the lock. Then other developer can take update and checkout the file in same manner.
  2. Edit – merge – commit: No need to checkout the file first. You can start working and making changes in the file. When you are done with your changes and ready to commit, you need to take update and merge other programmer changes in your file and commit the change in the version control system. More than one programmer can work in same file in this process. Because in this process no one take write lock in the file and can make changes in same file at the same time, you need to merge the other developer’s changes before commit.

In respect to connection with version control system server, there are two types:

  1. Connected version control system: All history information are placed in server. You have a working copy in your computer. You need to connect to server at the time of taking update, commit, checking history, creating branch.
  2. Disconnected version control system: You have working copy with full history information in your computer. You have the full repository in your computer. You can commit, check history, create branch while you are not connected with the server. Finally you can connect with server and pull changes from other developer from server, merge your changes and push your changes to server. Because you have the full repository in your local computer, commit, check history, branching process become very fast. All the developers has one full repository in their computer. It is like a backup copy of repository in all developer’s local computer.

Git

Git works like a distributed version control system. There are many Git implementations. If you are working in Windows, you need msysgit which is the Git implementation for Windows. Also you need to install one command line tool to work with Git from command line. For Windows you can install posh-git which is a Git in Powershell.

Also you can install a GUI tool for Git like GitHub for Windows. If you are working with Visual Studio you can work with Git from Visual Studio. Visual Studio also have GUI tool for Git. While you are working in Git GUI tool if you cannot find some task in that GUI, you can use command line tool right there to complete that task. GitHub for Windows and Visual Studio both support this.

Git hosting

You can use any Git hosted server like GitHub, CodePlex, Visual Studio Online etc. The most popular Git hosting is GitHub. Also Visual Studio online support Git and TSF both.

Hope you will have good working time with Git.

If you like this post please follow this blog. You can also follow me on twitter.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s