Most Useful GitHub Commands for Programmers

Dhayanidhi Chinnaraj
TechJedi
Published in
2 min readSep 1, 2022

In this Blog, we going to learn about GitHub commands and their purpose. Every programmer should have a piece of good knowledge of GitHub commands. Here I listed some of the most important commands for programmers for their day-to-day use.

git init

  • Initialize the project folder as a git repository.

git clone <HTTP link or SSH Keys>

  • Download your project repository from GitHub to the local storage.

git branch

  • List all the local branches in the repository.

git branch <branch_name>

  • Create New Branch locally.

git branch -d <branch_name>

  • Delete the branch named <branch_name>.

git push origin — delete <branch_name>

  • Delete a remote branch.

git add <file_name>

  • Stage the unstaged specific file.

git add .

  • Stage all unstaged files together.

git reset

  • Unstage all files.

git commit -m <” message”>

  • Commit the staged files to remote.

git checkout -b <branch_name>

  • Create a fresh new branch and switch to that created branch.

git checkout <branch_name>

  • Switch to a branch that already exists.

git merge <branch_name>

  • Merge this branch with the current working branch.

git merge <source_branch> <target_branch>

  • Merge the branch into a target branch.

git merge -abort

  • Abort all actions, if any conflicts arise.

git remote

  • Display the connected remote repositories.

git stash

  • Take the uncommitted changes(staged and unstaged) and save them away for later use.

git stash clear

  • Remove All staged entries.

git push origin <branch_name>

  • Push all commits to the remote repository.

git push origin — delete <branch_name>

  • Delete a remote branch.

git pull

  • Update the local repository to the latest commit.

git pull origin <branch_name>

  • Pull changes from the remote repository.

git diff

  • Display the changes between commits.

git status

  • Display the state of the current working directory and in the staging area.

git log — summary

  • View changes in a detailed way.

--

--