The Git Commands Every Developer Should Know

Meysam Mahfouzi
7 min readMar 8, 2023

I’ve found that 90% of the time, I rely on a handful of essential Git commands to manage my codebase. In this article, I’ll share the Git commands that I use most frequently, and by mastering them, you’ll be able to handle the majority of situations that arise in your development work.

Cloning

First things first, we need to clone a git repository:

git clone git@github.com:namespace/cool_project.git

Getting The Latest Changes

Pull or Fetch? That is the question!

Suppose you cloned a git repository one month ago, and now you want to work on it. Before making any changes, it’s important to ensure that you have the latest version of the code.

To get the latest changes, simply run the following command:

git pull

To be honest, I’ve never used the git fetch command, and I don’t think I’ll ever use it!

The git fetch command retrieves the latest changes from the remote repository but does not automatically merge them into your local repository. Instead, you must run the git merge command separately to incorporate the changes.

Creating a new branch

--

--