Start Git With NO Effort — 1…!

Well many wonder why GIT? I suggest them to “Give It a Try”. Its more than other centralized version control system available in IT market today.

I being more philosophical, would try restricting my articles from theory and would focus on some getting started concepts, with ease.

NOTE: My articles on GIT will be totally based on commands and their use. I recommend to not use UI or any plugin with IDE, rather use GIT BASH Command line interface. The initial articles may contain more theory as it is must to get started.

I assume, the readers are aware about some basic theoretical background of GIT. When working on a project with minimum 2 or more members, there may be a case where many functionalities being implemented individually by different team members. Also the case may be, a single functionality being worked upon by multiple team members. Here one must look for version control system(vcs). It helps to track the work of each team member and also helps in maintaining the history of each and every change made by any of the team member, sometimes helps in avoiding the blame game ;).

Assume that I am joining a team whose architect and operations team has already designed the flow of version control and the backbone(skeleton) of code is created and made available at some remote location, this location is termed as REPOSITORY (aka remote repository, central repository, etc.). This repository is accessed by every allowed team members to work upon.

I need to start working and so the first and foremost step for me is to get that repository onto my own machine(laptop/desktop). Technically it is termed as cloning of repository. Below command helps in cloning the repository on my machine.

git clone <clone_url> [<folder_name>]

clone_url is SSH(Secure Shell) or HTTPS(Hypertext Transfer Protocol Secure) clone url available to clone the repository.

folder_name is optional. If provided, the folder with provided name will be created and within same the repository will be cloned.

Now, I am sure you are comfortable in getting code from remote repository onto your local machine.

Some details to be observed here before starting with development on cloned code-base, to understand GIT. Once you clone the repository, at the clone location you need to check for .git folder which is hidden by default. It contains around 5 folders and 8 files normally but it keeps growing with the usage of different commands while interacting with repository. We’ll not look at all of those files and folders but definitely take a look on some of those.

  1. config: This file contains the local configurations specific to that cloned repository. Example: Core configurations, remote details, checked out branch details and user details. (For detailed information on these configurations we’ll look into one of the future articles)
  2. HEAD: This file contains the entry which points to the current HEAD that is current commit.
  3. FETCH_HEAD: This file contains the rack of what has just been fetched from the remote repository after firing latest git fetch command.
  4. logs: This folder contains the log of activities performed on local and remote repository.
  5. refs: This folder contains the latest references of all the local branches, remote branches, tags, etc.

Now we are ready to start the development after knowing the very basic background of GIT and understood some important files and folders that git creates to help us manage and maintain history locally and remotely thereby keep both in sync. The .git folder is sometimes used for auditing purpose also.

Post reaching at this level of understanding, one must not blindly start working on cloned repository. One must think upon how to start working. So here arise series of questions like “which branch I am on?”, “which branch I should work upon?”, “what is a branch?”, “are there different types of branch?”, “if there are types of branch then do there exist types for repositories?” and so on…

I will try answering all such questions in upcoming articles, as sequential as possible, to stay on track and master GIT easily. And finally the vcs diagram in my article will be elaborated the readers, post answering all such questions.

Please post your queries, comments and topics that need clarity in current article. Most importantly, correct me if any information is misleading or incorrect. Lets learn together…

Part 1 Concludes here…