Git Terminologies – Checkout

Here we will see basic commands and git terminologies overview that you need to start using git. The terms are same irrespective of which Git platforms or Azure Repos , or Gitlab , and various others you refer to .

Read about Git Terminologies – Branch to get better understanding of checkout command.

Git Checkout

Git Checkout

Checkout is performed whenever one wants to move the git reference from branch A to branch B.  When we checkout ,the local folder  files will be refreshed/replaced with the branch B changes.

As you see here , i have the same branching structure created previosuly. Now in this case developer has cloned Feature 1 and is currently working on related changes,

Lets say, you ask developer to start working on feature 2 , then the developer would ‘Checkout’ feature 2 branch and go ahead.

Note that, at the time of checkout, any pending change would either need to be reverted or stored for later use , we will learn about this later in the course.

Remember, while working on feature 1, the developer can checkout local branch APIChanges or UIChanges to work on corresponding changes.

Command Overview

Let’s look at the git command in detail. Read the article <> to install the command line tool required to try this command.

git checkout <BranchName>

Above command will clone the ‘default’ branch from the repository.

Mandatory Parameters

branchName – Name of the branch to checkout

Optional Parameters
–detach (-d)checkout a particular commit instead of checking out the branch
–merge (-m)merges the local changes if any

Share your email id here, to get access to a sample repository to try out above command.