Git is an amazing version control system. Here are few basic commands that you need to start any git project.

git init

git init is used to create a new repository. If you have a local project folder in your system, then git init command will make the project as a repository.

git add

git add used to add the unstaged files to the staging area.

git add * adds all the changed/unstaged files to the staging area.
git add [file] adds the specific file to the staging area.

git commit

git commit is used to record the changes to the repository.

Options:
-m [message] : message related to the changes you have done. Used for team-mates to understand what has changed.
-a : includes all the changed files in the commit.

git diff

git diff shows the differences which are not staged yet.
git diff --staged shows the differences between the staged files and latest version.

git status

git status lists all the files that have to be committed.

git reset

git reset reverses the actions done.

git reset [file] – It unstages the file while preserving its content.
git reset [commit] – It undo all the commit after a specific commit while preserving the changes locally.

git remote

git remote is used to connect the local repository to the remote server.
Example: git remote [variable_name] [remote_server_link]

git push

git push send the committed changes of local repository to remote repository.

git push [variable_name] master sends committed changes of master branch to the remote repository
git push [variable_name] [branch] sends the specified branch commits to remote repository
git push -all [variable_name] sends all branches commits to remote repository.