In this tutorial, we will see the most important daily usage of git commands. Every developer should know about this. It’s really helpful when you are working on a team project. The list of git commands are.
List of Git Commands (commonly used)
Git Clone command is used to download the project from a remote server. Otherwise you can also download the project by visiting GitHub’s website.
git clone your-repostory-link
Git Branch command is used for more developers and programmers can work one project at a time. Follow the below git commands to create or delete the branches of your project.
Creating a new branch:
This command creates the new branch locally
git push -u
This command is used to push the new branch into the remote repository.
git branch or git branch --list
Deleting a branch:
git branch -d
The Git Checkout command is used to switch one branch to another branch and also we can use it for checking out files and commits.
git checkout branchname
The below command is used to create a new branch and switch to it at the same time.
git checkout -b branchname
Git Status displays the working state of the current branch like commits, files created, modifications etc..
Git Add command is used to move files from the working directory to the staging area and it does not affect the repository in any other way until we run the git commit.
To add a single file:
To add everything at once:
git add -A
The Git Commit command is very useful for developers. We can write short messages of what modifications we have done to the project. So this message helps to understand the source code long after if needed.
git commit -m "commit message
Git Push command is used to upload your new branch or local contents to a remote repository.
Git Pull command is used to download a branch from a repository, then it merges into the current branch.
Git Revert command reverts the last changes of the source code. It helps to undo your changes instead of deleting the commit history.
Git Merge command is used to merge the one branch to the another branch.
Git Remote command is used to create new remote connections on popular services like GitHub, Bitbucket and Gitlab.
Git Fetch command fetches required files from the remote repository to the local repository.