DEV Community

Cover image for My Frequently Used git Commands
Rohith V
Rohith V

Posted on

My Frequently Used git Commands

On the mid of 2020, I started learning and using git and it's commands. Till now, I continued least 1 contribution to any of my public repo.

There are some commands that I frequently use.

  • git clone

Helps to clone a particular repository provided the repo-url into the specified <directory>.

  • git status

Helps to view the status of the project or repo including staged, unstaged, and untracked files.

  • git add

Helps to add a particular directory or files that have the changes.

  • git add .

Helps to add all the files in the currently directory that have the changes.

  • git commit -m ""

Helps to commit all staged changes. We can replace <message> with good commit messages so that everyone can understands what the change we have done.

  • git commit --amend

Helps to amend the commit messages if the commit is done only in the local repository and not been pushed.
We can type this command and press enter which then opens a text editor where we provide the new commit message.

  • git push

Helps to push the local repository changes to the remote repository.

  • git pull

Helps to incorporates changes from a remote repository into the current branch. If the current branch is behind the remote, then by default it will fast-forward the current branch to match the remote.

  • git init

Helps to start a new repository locally.

  • git remote add

Helps to add a new remote repository providing the <url>.

Git

These are very very common git commands that are being used by me in a regular basis.
What are the commands you guys are using regularly? Please free feel to share so I can also learn new things from all of you.

Top comments (2)

Collapse
 
shaneikennedy profile image
Shane Kennedy

Nice post Rohith :) To add to this list I use git rebase quite a bit, more here juniordeveloperdiaries.com/git-reb... and here dev.to/shaneikennedy/interactive-r...

Collapse
 
rohithv07 profile image
Rohith V

Thank Shane.