Get started with Git version controlling

Version controlling using Git

Osanda Deshan Nimalarathna
Test Automation Master
4 min readFeb 27, 2019

--

Git Workflow Diagram

For this tutorial, I am using TortoiseGit as the Git client.

You can download TortoiseGit from here.

1) Get a clone of the project repository

  1. Get clone URL from Git.
Getting clone url from Git

2. Navigate to the location where you need to have the cloned project.
3. Right click and click on Clone.

Cloning the repository

4. Paste the clone URL and press Ok button.

Cloning the repository

5. Once the cloning process completed, press Close button.

Cloning the repository

Note: You can get a clone of the project repository using command line as well.

git clone <remote_url>

2) Create a local branch from the master branch.

  1. Go inside the project folder.
  2. Right click and navigate to TortoiseGit → Create Branch
Creating a local branch

3. Provide a name for the branch and click Ok button.

Creating a local branch

Note: You can create a local branch from the master branch using command line as well.

git branch <branch_name>

3) Switch to that new local branch

  1. Right click and navigate to TortoiseGit → Switch/Checkout
Switching to the new branch

2. Select the new branch and click on Ok button.

Switching to the new branch

Note: You can switch to that new local branch using command line as well.

git checkout <branch_name>

4) Then work on that branch

You can do your changes now.

5) Commit your changes

  1. Right click and navigate to Git Commit → “Branch name”
Commiting the changes

2. Enter a commit message and click on Commit button.

Committing the changes

Note: You can commit your changes using command line as well.

First add new files to the Git repository.

git add <file or directory name>

Commit your changes into the local repository.

git commit -m "Commit message in quotes"

6) After committing your changes, get a pull from the master branch and resolve the conflicts if needed

  1. Right click and navigate to TortoiseGit → Pull
Getting a pull from the master branch

2. Select the master branch and click on Ok button.

Getting a pull from the master branch

3. Click on Close button.

Getting a pull from the master branch

Note: You can get a pull from the master branch using command line as well.

git pull <remote_url/remote_name> master

7) Push your changes to the remote

  1. Right click and navigate to TortoiseGit → Push
Pushing your changes to the remote

2. Click on Ok button.

Pushing your changes to the remote

3. Click on Close button.

Pushing your changes to the remote

Note: You can push your changes to the remote using command line.

git push <remote_url/remote_name> <branch_name>

8) Create the pull request

  1. Go to Git and click on “Pull requests”.
Navigating to pull requests

2. Click on “New pull request” button.

Creating the pull request

3. Change the source branch to the created branch and click on “Create pull request” button.

Creating the pull request

4. Click on “Create pull request” button.

Creating the pull request

9) Merge the pull request

  1. After reviewing the pull request, any team member can merge the pull request to the master branch by clicking on the “Merge pull request” button.
Merging the pull request

2. Then click on “Confirm merge” button.

Merging the pull request

3. Now the pull request is successfully merged with the master branch. You can delete the branch you have created by clicking on “Delete branch” button.

Deleting the created branch

--

--

Osanda Deshan Nimalarathna
Test Automation Master

Founder of MaxSoft | RPA Solution Architect | Open-source Contributor | Automation Framework Developer | Technical Specialist