10 Basic git Commands

Kesavi Kanesalingam
3 min readMay 5, 2020

--

In this post, let’s see some basic git commands.

1.git config

git config command is used to change the name and email that associated with your Git commits.

To confirm that you have set the Git username and email correctly:-

2.git init

To initialise a git repository for a new or existing project.

3.git clone

git clone is a Git command line utility which is used to target an existing repository and create a clone, or copy of the target repository.

git clone <:clone git url:>

4.git status

To check the status of files you’ve changed in your working directory, i.e, what all has changed since your last commit.

5.git add

The git add is a command, which adds changes in the working directory to the staging area.

6.git commit

This commits your changes and sets it to new commit object for your remote.

7.git push/git pull

Push or Pull your changes to remote. If you have added and committed your changes and you want to push them. Or if your remote has updated and you want those latest changes.
git pull <:remote:> <:branch:> and git push <:remote:> <:branch:>

8.git branch

List all of the branches in your repository.

9.git checkout

The git checkout command is used to switch between branches in a repository.

10.git merge

Merge two branches you were working on.
Switch to branch you want to merge everything in. git merge <:branch_you_want_to_merge:>

--

--

No responses yet