Git Cheat Sheet

Git Cheat Sheet

Hello Folks,

In this article i will be writing cheat sheet for git basic commands.

1.Git Init Command

Create an empty Git repository or reinitialize an existing one.

Syntax:

$git init demo
The init command will initialize an empty repository.

2.Git Add Command

Add file contents to the index.

Syntax:

$git add filename

3.Git Status Command

Shows the working tree status.

Syntax:

$ git status

4.Git Commit Command

Record changes to the repository.

Syntax:

$git commit -m "Commit Message"

5.Git Push Command

Update remote refs along with associated objects.

Syntax:

$ git push [variable name] master
This command sends the changes made on the master branch, to your remote repository.

$ git push --all  
This command pushes all the branches to the server repository.

6.Git Pull Command

Fetch from and integrate with another repository or a local branch.

Syntax:

$ git pull URL

7.Git Branch Command

List, create, or delete branches.

Syntax:

$ git branch

8.Git Merge Command

Join two or more development histories together.

Syntax:

$ git merge BranchName

9.Git Log Command

Shows commit logs.

Syntax:

$ git log

10.Git Clone Command

Clone a repository into a new directory.

Syntax:

$ git clone URL