The Most Usable Git Commands

GitHub is a most usable collaborative tool for a software developer. Because if you are a developer, you have to work with a team. Therefore you want to share your codes with others. Not only codes, you can share any documents using this tool. you need to share those things to the GitHub. For this you can use command line to share your codes. Nowadays we can see many tool otherthan command line to share your codes easily to GitHub like GitKraken. But, In the industry we can see many of them are used command line. Because of that as a developer you need to know most usable git commands. Now, Let’s see what are the most usable git commands.

1. Git clone

Git clone is a command for existing codes from a repository. In the other words, git clone is basically does connect existing repository with your github account and save that repository in your computer.

git clone <repository-link>

As an example, one of a developer in your project team create a repository and share the repository linked with you. Now, you want to clone that repository and save it to your computer.

Image 01-Git clone

First, you need to go that repository via inviting link and copy the link (The above highlighted link). After you need to paste the link in the command line under the git clone command.

2.Git status

Git status command gives all the details of the current branch.

git status

From using this command, we can see,

  1. if there is anything to commit, push or pull
  2. files are staged, unstaged or untracked
  3. there are any files or codes modified, created or deleted
Image 02-Git status

3.Git stash

When you clone a repository you can change codes in your computer. After change the original codes you cannot pull another codes without commit your changes. But, you don’t want to add your changed codes into the original code. Therefore, you can use Git stash command, it takes your uncommited changes saves them away for later use.

git stash

4. Git pull

Git pull command gives new updates of remote repository. From this we can take new changed codes which others changed. Before using git pull command, you should use git stash or git pull command. if you use git stash command you can see original code without your changes. otherwise, If you use git push command you can see the code with your changes.

git pull

5. Git stash apply

After pull the codes which other developers are changed, from remote repository you can add your changes to that code. git stash and git stash apply are interconnected.

git stash apply

6. Git commit

After you changed your original code you want to save those changes. For that you can use git commit command. As well, while you commit changes you need to write a short description to explain what you have developed or changed. Otherwise, others cannot find what are the changes you did.

git commit -m "short Description"

7.Git push

After you committed your changes you need to share them into remote repository. Git push command uploads your commit to the remote repo.

git push <remote> <branch-name>

As well, if you create a new branch, then you add that as follow:

git push --set-upstream <remote> <branch-name>


git push -u origin <branch_name>

If your repository is not save in c folder, first you should give your path to command line. first, go to the folder where you save your repository. After click the path and write cmd and click enter. According to that you can take your folder path in to the command line.

Image 03

In addition, there are many git commands you need to use in your daily programming. Those are my most used git commands I come across my daily programming. I think you learn something this article.

Thank you for reading!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store