Basic Git Commands you should know as an Open Source Contributor.

Basic Git Commands you should know as an Open Source Contributor.

It's simpler than You think.

Yes! I'm to be here again this week, this is the fifth article on the open-source series. If you don't know how to contribute to open-source software, you can read the step by step guide to start contributing to open-source as a beginner here and if you are still looking for open-source communities you can join you can check out these seven(7) amazing open-source communities you can join as a beginner here

When collaborating or contributing to an open-source project, there are certain git commands you must understand. I can't start telling you how confused I was with git commands when started contributing to open-source. There were occasions I get confused and reach out to my teammates to help out and later realized it was a simple thing. There are a lot of git commands of course but for the purpose of this article, I will be sharing the basic git commands a contributor must know and also some basic terms on Github like;

  • Git Clone

  • Git Checkout

  • Git Add

  • Git Status

  • Git Config

  • Git Commit

  • Git Pull

  • Git Push

Now let's take a look at each of them in detail.

Git Clone

This command is used to download the source code from a remote repository.

$ git clone <https://url-of-the-repository>

The Git Clone will create a local copy of a project that already exists remotely (remotely as in it is available on GitHub, or GitLab). The clone includes all the project’s files, history, and branches.

This will allow a contributor to have access to the project and make their contribution

Git Checkout

Contributing to open-source involves collaboration, simply put, it allows teamwork which involves you working on different parts of the project this makes. When you clone a project on your PC is it necessary you switch to a branch you can work with.

This makes the checkout command is one of the most important functionalities of Git. This allows teams to work on the same code base in parallel. This command will create a new branch only in your local system and also enables you to switch to a new branch at the same time with just one command.

git checkout -b <new branch name>"

To check the list of branches in a repo, you can type this command.

$ git branch --list

Git Add

Each time you make a change in the code base either you create a new file, delete it or edit it, you’ll have to tell Git to track it and it to the staging area. Otherwise, the files you made changes to wouldn’t be added when you try to push your changes. Any changes that are staged will become a part of the codebase when the code is merged.

This can be done in several ways like:

$ git add <the name of the file you worked on>


$ git add -A
$ git add .

This is very much applicable when working on multiple files or not. You can also use this git add command.

Git Status

Have you ever felt lost in your own repo? Like you just don't know what is going on or you are confused, you don't know if your code is staged or not. Now, this is where git status comes in.

This command will check the status of your added changes and it will show you if they are properly added or not. Git status command shows the status of changes as untracked, modified, or staged.

$ git status

You can always check the status before adding your changes and even after adding your changes.

Git Config

The git config will enable you to create a user's profile which is important for signing off commit. If you haven't heard about signing off commits don't sweat you will know that soon.

$ git config --globe

This will enable you to always sign off commit whenever without using the git config anymore.

Git Commit

The git commit is like a point where all the changes that have been added to your staging area are been saved.

Each time you commit your code changes, you’ll also need to include a message to briefly describe the changes you just made. This helps the project maintainers to quickly understand what was added, changed, or removed. And here also you can sign off while committing your changes.

$ git commit --signoff -m “<commit-message>”

Git Push

This command makes all your committed changes available to the project maintainers to review, you’ll have to push them to the remote origin.

$ git push <remote> <branch-name>

Do you remember the branch name you checkout to? You are going to be pushing your changes to the remote origin(the main repo) with the branch name you created after cloning the project.

Git Pull

The git pull command allows you to fetch all the changes that have been pushed since your last cloning by other contributors and automatically merge them into your local repo.

$ git pull <remote>


These basic git commands should enable you to go from cloning repository(project) all the way to getting it merged to the parent branch by the project reviewers. Knowing all these commands will be helpful to you to make your contributions. I really hope you find this article helpful.


Git handbook

Git Docs