Git Commands

Create a repo

git init

Add changes into index

E.g. Add all the changes under current directory

git add .

Add a particular file

git add ./path/to/your/file/

Check repo status

git status

Commit changes

git commit -m "<the commit message>"

Push changes

git push


Add existing repo to Git server

Step 1, add origin to remote

git remote add origin <repo-git-url>

Step 2, push origin as up stream to master branch

git push -u origin master



Git help

git help

List available subcommands and some concept guides

git help -a
git help -g

Command help

git <command> --help
git help <command>


git add --help



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s