Git Commands

What is Git ?

It is open source version control system used to handle very small to very large projects efficiently.Git is used to track the changes in source code,enabling multiple workers to work together on non linear development.

1.Init

It is used to initialized the empty repository

git init

2.add

It is used to add all the files which are created or changed data in existing files.

git add filename
git add .

3.Commit

It is used to commit the files.

git commit 
git commit -m "message"

4.Branch

It is used to create new branches

git branch BranchName

5.checkout

It is used to shift from one branch to other branch.

git checkout BranchName

6.merge

It is used to merge the branches.

git merge branchname

7.rebase

It is used for combining the sequence of commits to a new base commit.

git rebase branchname

8.reset

It is used for resetting current branch to specific state

git reset 
git reset --hard

9.push

It is used to push the contents from local machine to remote machine.

git push orgin master

10.clone

It is used to get the contents from remote machine.

git clone <https link of repo>

11.pull

It is used to get the contents with changes in repo from remote machine to local machine

git pull 
git pull <https link of repo>

12.log

It is used to give information of all commits.

git log

13.status

It is used to get the status.

git status