What is Git ?

Git is the free and open source distributed version control system that’s responsible for everything GitHub related that happens locally on your computer. This cheat sheet features the most important and commonly used Git commands for easy reference.

 

INSTALLATION & GUIS

With platform specific installers for Git, GitHub also provides the ease of staying up-to-date with the latest releases of the command line tool while providing a graphical user interface for day-to-day interaction, review, and repository synchronization.

GitHub for Windows

https://windows.github.com

GitHub for Mac

https://mac.github.com

For Linux and Solaris platforms, the latest release is available on the official Git web site.

Git for All Platforms

http://git-scm.com

After installation you need to configure user information used accross all lcoal repositories by below commands

git config –global user.name “[firstname lastname]”

set a name that is identifiable for credit when review version history

git config –global user.email “[valid-email]”

set an email address that will be associated with each history marker

git config –global color.ui auto

set automatic command line coloring for Git for easy reviewing

What is Git Branching ?

Git branching allows developers to diverge from the production version of code to fix a bug or add a feature. Developers create branches to work with a copy of the code without modifying the existing version. You create branches to isolate your code changes, which you test before merging to the main branch (more on this later).

There is nothing special about the main branch. It is the first branch made when you initialize a Git repository using below command;

 git init 

When you create a commit, Git identifies that snapshot of files with a unique SHA-1 hash. When you initially create a branch, Git creates a new pointer to the same commit the main branch is currently on. The diagram below shows both branches have the same snapshot of code at this point.

To retrieve an entire repository from a hosted location via URL, you need to execute command

git clone [url]