Different Git commands

Following are the different git commands:

  •  Clone a Git repository:

git clone username@yourhost.com:path/to/repo/repo-name.git

  •  Initializing an empty git repository:

git init

  • Adding files to git repository:

 git add .

  •  The commit command:

 git commit -m “Initial import”

  •  Viewing the commit log:

 git log

  • Checking the current status:

 git status

  •  Finding the difference between commits:

 git diff

  •  Creating branches:

 git branch branch_name

  •  Moving to a branch :

 git checkout branch_name

  •  Listing all branches:

 git branch

  •  Merging two branches:

 git checkout master

 git merge branch_name

  •  Deleting a branch:

 git branch -d branch_name

  •  Pushing:

 git push (remote) (branch)

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment