Github Commands

Let’s start with what is git then we will see GitHub commands with examples.

What is Git?

Suppose a group of developers working on a huge project and every one of them is doing an edition in the project but they can’t share the files through email because of file size issues so there is a simple way they can easily share those files through git.

Git is an application used by developers, it is an amazing tool for managing complex project data.

Git is an open-source application you can easily download into your system. Git enables developers to make changes in the project online or by pulling(downloading)  the project file.

Basically, we create a repository(folder) on GitHub using the git command in the windows command prompt and then we push(upload) the project online so the team of developers can see and make changes and they can have a copy of the project in their local systems as well.

Branching in Git

Branching is a very important and necessary part of git. We create branches for making a copy of the original code file without affecting the original code file.

Important Git Commands

Git version command

After installing git in your system execute the following command for checking the version of git:

git version

Git config command

After checking the version, set the global config variables so the other team members can access the project easily. Use the following commands.

git config "example"
git config "[email protected]"

Git init command

for initializing a repository in the system use the following commands.

mkdir test
cd test
git init

Note: you can name the folder whatever you want, I named it a test.

After this, create a file “example.txt”   write something and save it in the test folder.

Git status command

You can check the status using the below command.

git status

Git add command

Now for making a commit we will add that .txt file that we created above by using the following command.

git add filename.txt
git commit –m “yourmessage”

Git diff command

If you did any changing in the file so you can check the difference in the .txt file using the following command.

 git diff

Git remote add command

Now we will connect the git local repository to GitHub remote repository by using the following command.

git remote add origin

Git push command

We will push(upload)the file to GitHub remote repository by using the following command.

git push origin master 


git push origin main


In this article we discussed what is git and what is branching in git, then we saw a few important commands of git.

We also use those commands and discuss the procedure of creating a local and remote repository and connectivity with GitHub, we also saw the procedure of pushing files on Github.

Thanks for reading, hope you like the tutorial if you have any queries regarding this article, so feel free to ask below.

Leave a Comment