-
Notifications
You must be signed in to change notification settings - Fork 1
Git Common Commands
fredchu edited this page May 15, 2012
·
1 revision
$ git config --global user.name ben
$ git config --global user.email [email protected]
$ git config --global core.editor mate
$ git config --global merge.tool mate
$ git config --global color.diff auto
$ git config --global color.status auto
$ git config --global color.branch auto
$ git config --list
$ git help <verb>
$ git init <dir name>
$ mate .gitignore
$ mate .gitkeep
- syntax
$ git clone <url>
$ git clone git://github.com/schacon/grit.git
- clone from github
$ git clone git://github.com/schacon/grit.git mygrit
$ git status
- syntax
$ git add <expression>
- add or update all file under the directory
$ git add .
- add or update all file end with .c
$ git add *.c
- only update exist file
$ git add -u
- add or update index.php and register.php
$ add index.php register.php
- syntax
$ git commit <option>
- commit files with description "blah"
$ git commit -m "blah"
- syntax
$ git rm <file name>
- remove staging file
$ git rm --cached <file name>
- change file name
$ git mv <old_file> <new_file>
$ git diff
$ git diff --cached
$ git diff HEAD
$ git reset HEAD <file name>
$ git checkout <file name>
$ git tag -a v1.0.0 -m "Creating the first official version."
$ git show v1.0.0
$ git tag -l
$ git tag -l 'v1.4.*'
$ git tag -a v1.2 7c5f24d
$ git push origin v1.0.0
$ git push origin --tags
$ git tag -d v1.0.0
$ git push origin :refs/tags/v1.0.0
$ git branch new_branck
$ git rebase -i <commit number>