You are using an older browser that might negatively affect how this site is displayed. Please update to a modern browser to have a better experience. Sorry for the inconvenience!

Introduction to Git and Jenkins


By: Radha

 Introduction to Git 

Git is the distributed version control system. It allows us to have “versions” of a project and tracks the changes made to the code over the time. Also, we can compare two versions and undo the changes if necessary. Git plays a vital role on larger projects in which more than one developers are working on the same project.

For Further exploration, refer: https://git-scm.com/videos

Steps to Install Tortoise 

  1. Go to link https://tortoisegit.org/
  1. Click Download.
  1. Choose the download link that suits for your system (either for 32-bit OS or for 64-bit OS)

4.Once the download is completed, follow the below steps to Install tortoise:  ​

  1. Open Set up Wizard.
  2. Click Next [Symbol] Next [Symbol]Install.
  3. Select Yes to install.
  4. Click Finish.

 Steps to Create Account in GitHub 

  1. Go to the link https://github.com/
  1. Fill in the following fields: Username, Email Address and Password for the GitHub Account.
  1. Click Sign up for GitHub Button.
  1. Choose Unlimited public repositories for free as personal plan.
  1. Click Continue Button.
  1. Provide the general information, if necessary. Otherwise skip this step.
  1. Click Submit Button.

To Create a Repository in GitHub 

  1. Click the plus on the top right corner. Choose New Repository.

 

  1. Enter the name and Description (Optional) of the repository.
  1. Select Initialize this repository with a README.
  1. Click Create Repository Button.

Steps to Create Branch 

  1. Go to the Repository.
  1. Click the Branch: Master drop down.
  1. Give name for the Branch and Click Create Branch

To Clone the Git to local System 

  1. Go to the repository. Click Clone or Download Button
  1. Copy the URL from the drop down.

  1. Create a New Folder in your System.
  1. Right Click on the folder. Choose Git Clone.

  1. In the dialog box, paste the above copied URL in URL field.

  1. Click OK Button.

Command to clone Repository,

Git clone https://github.com/your-username/repository-name

e.g.: Git clone https://github.com/MetaSoftTechSys/TestProject

 

To Pull code from GitHub 

  1. Right Click on the folder (That is cloned in the above step)
  1. Choose TortoiseGit [Symbol] Pull [Symbol] Click Ok.
  1. To view the difference, Click Pulled Diff.

 

Command to pull: 

Git pull

 

To Commit code to GitHub 

  1. Place the code in the folder to which want to commit.
  1. Right Click on the root folder. Choose “Git Commit [Symbol] …”.

  1. Provide the Message for Commit.
  1. Select the files which you want to commit.
  1. Click Ok Button.

Command to Commit: 

Git Commit –all

To Push Code to GitHub

  1. Right click on the Folder. Choose TortoiseGit [Symbol] Push.
  1. Select the branch to which you want to push.
  1. Click Ok Button.