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/MyClass.java

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

 


Help

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>

E.g.

git add --help

 

Advertisements

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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