Git commands

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Filament.io 0 Flares ×




Clone a remote repository

To clone master branch from remote repository on local machine:

# git clone -b master <git url>

Checkout branches

To checkout branches other than master:

# git checkout –track origin/<branch1>

# git checkout –track origin/<branch2>

Add untracked files to git

# git add

Add all files to staging area

# git add -A

Check tracked/untracked files

# git status

Commit files to git

# git commit -m “message”

Commit all files to git

# git commit -a -m “message”

Check all commits

# git log

Create a branch

# git branch

Delete a branch

# git branch -D <branchname>

View all branches in local repository

# git branch

View all branches in remote repository

# git branch -a

Switch to another branch

# git checkout <branchname>

Push changes from local copy to remote

# git push origin master

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Filament.io 0 Flares ×

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA Image

*