This page looks best with JavaScript enabled

Git in 5 minutes

 ·  ☕ 2 min read  ·  ✍️ Syed Dawood

Yes, you read it correctly.5 minutes.I will not be covering what is version control or what is git. Rather a basic workflow with git.

  • Init or clone

  • Add (for init)

  • Commit

  • Pull-Push

init or clone

Here it starts, you want you use git for existing project which was not in any version control. This is very first up terminal/command prompt.

git init .

or you can clone a repo(a fancy word for code in VCS) in this context. here's how you do it.

git clone

Lets move to next step.


So you've initialized repo in the current directory but your files are not being tracked because you haven't said git to do so.In git terminology we call it staging changes.if you've just cloned a repo, this step is not needed unless you've added new files are did some changes to existing ones.

git status run this command every now and then to see whats current status of your project.

git add [<FILE_NAME>|.]

This command will stage file(s) in the repository.


Wait, In last step we did added changes right?. Whats with committing? .Think of it this way,staging changes means you have prepared files to commit.Well people who are gamers can think of commit as a save point.Once saved, you know you can jump back to save point,if you break something.

git commit -m "Write your commit message here"

Protip: use git status often

You will see a verbose output about what git is doing,read through if this is your first time.


Great you've committed , now what.Now lets push the changes to server.But hold your horses it a best practice to pull before you push.If you are only one who is making changes you don't have to worry about overwriting changes.Server can be anything [GitHub, Gitlab, bitbucket or any other]

git pull <remote_branch_name>

ex : git pull origin

Here some conflicts may occur like you have changed a file and other contributors have done the same. So, compare files include or exclude changes and commit. Now you are good to go. Lets push it

git push <remote_branch> <local_branch>

ex: git push origin master


This is like 50-60% of git you will ever need to know.Jump in and use you it your next project. The infographic below will explain if you didn't catch my point.

digraph MyGraph {
  "init/clone" -> "add/change"
  "add/change" -> commit
  commit -> pull
  pull -> push
  push -> "add/change" [dir=both]
Share on

Syed Dawood
< frontend | backend | fullstack > Developer