Tag

git-command

Browsing

Basic git Introduction

Most commonly used modern version control system in the world today is Git. Git is a mature, secure, most actively maintained open source project originally developed by Linus Torvalds in 2005.

Why we use git

Most commonly used modern version control system in the world today is Git. Git is a mature, secure, most actively maintained open source project originally developed by Linus Torvalds in 2005. Git is distributed version control system. Git maintains three copy repository of version control, first are the working repository and the second one is staging repository and the third one is server repository. First two repository copies are stored in the client machine, that makes it easy to work offline.

You work locally and commit staging repository without need of internet and then sync your repository copy with server repository.

The important things are client must be synchronize code with server repository before creating new version code

How to install git

There are several way to install git in different platform OS

Install git on Mac

The many way to install git in Mac OS. Mainly two way that i personally like. Before moving forward we should check git is already installed or not . To find out, open a terminal and enter 

$ git --version
git version 2.7.0 (Apple Git-66)
The easiest way to install git via stand-alone installer
  1. Download the latest Git for Mac installer.
  2. Follow the prompts to install Git.
  3. Open a terminal and verify the installation was successful by typing git --version
  4. Configure your Git username and email using the following commands
$ git config --global user.name "user name"
$ git config --global user.email "user email"
# for example 
$ git config --global user.name "androidwave"
$ git config --global user.email "developer@androidwave.com"
Install Git with Homebrew

If you have installed Homebrew to manage packages on OS X, you can follow these step to install Git:

  • Open your terminal and install Git using Homebrew
$ brew install git
  • Verify the installation was successful by typing which git --version
$ git --version
git version 2.9.2
  • Configure your Git username and email using the following commands.
$ git config --global user.name "user name"
$ git config --global user.email "user email"
# for example 
$ git config --global user.name "androidwave"
$ git config --global user.email "developer@androidwave.com"

This step is common step for configure username and email for all OS

Install Git on Windows

Follow these step for Install Git on Windows

  1. Download the latest installer Git for Windows
  2. When you’ve successfully started the installer, you should see the Git Setup wizard screen. Follow the Next and Finish prompts to complete the installation.
  3. Open a Command Prompt (or Git Bash if during installation you elected not to use Git from the Windows Command Prompt).
  4. Configure your Git username and email using same command that I explained above

Install Git on Linux

Install git in Ubuntu using apt-get follow below step

  • In Ubuntu, git package available via apt. So for getting update version update apt via this command
$ sudo apt-get update
  • Now get git package via apt-get
$ sudo apt-get install git
  • Verify installation was successful for not using git –version
$ git --version
git version 2.9.2

Finally, Configure the username and email by using same command that i used previously

$ git config --global user.name "androidwave"
$ git config --global user.email "developer@androidwave.com"

Furthermore, read our git tutorials series for the complete understanding of Git. If you have any queries, feel free to ask them in the comment section below.

Git Tutorials and Training Series

  • Basic git Introduction
  • Setup Git Repository
  • Git Basic Commands
  • Setup and Share code with Git, Deployment on server
  • Best Practice of Git and We must adopt them