xxxxxxxxxx
11$ git clone https://github.com/godfreygan/api-test.git
xxxxxxxxxx
11$ git pull
xxxxxxxxxx
21$ cd api-test
2$ touch test.txt
xxxxxxxxxx
11$ git status
xxxxxxxxxx
11$ git add .
xxxxxxxxxx
11$ git commit -m '注释说明,如本次新增一个test.txt文件'
xxxxxxxxxx
11$ git push origin master
xxxxxxxxxx
11$ git config --list
xxxxxxxxxx
11$ git config -e [--global]
xxxxxxxxxx
21$ git config [--global] user.name "[name]"
2$ git config [--global] user.email "[email address]"
xxxxxxxxxx
71$ git add [file1] [file2] ...
2
3
4#### 2、添加指定目录到暂存区,包括子目录
5
6```bash
7$ git add [dir]
xxxxxxxxxx
11$ git add .
xxxxxxxxxx
11$ git add -p
xxxxxxxxxx
11$ git rm [file1] [file2] ...
xxxxxxxxxx
11$ git rm --cached [file]
xxxxxxxxxx
11$ git mv [file-original] [file-renamed]
xxxxxxxxxx
11$ git commit -m [message]
xxxxxxxxxx
11$ git commit [file1] [file2] ... -m [message]
xxxxxxxxxx
11$ git commit -a
xxxxxxxxxx
11$ git commit -v
xxxxxxxxxx
11$ git commit --amend -m [message]
xxxxxxxxxx
11$ git commit --amend [file1] [file2] ...
xxxxxxxxxx
11$ git branch
xxxxxxxxxx
11$ git branch -r
xxxxxxxxxx
11$ git branch -a
xxxxxxxxxx
11$ git branch [branch-name]
xxxxxxxxxx
11$ git checkout -b [branch]
xxxxxxxxxx
11$ git branch [branch] [commit]
xxxxxxxxxx
11$ git branch --track [branch] [remote-branch]
xxxxxxxxxx
11$ git checkout [branch-name]
xxxxxxxxxx
11$ git checkout -
xxxxxxxxxx
11$ git branch --set-upstream [branch] [remote-branch]
xxxxxxxxxx
11$ git merge [branch]
xxxxxxxxxx
11$ git cherry-pick [commit]
xxxxxxxxxx
11$ git branch -d [branch-name]
xxxxxxxxxx
21$ git push origin --delete [branch-name]
2$ git branch -dr [remote/branch]
xxxxxxxxxx
11$ git tag
xxxxxxxxxx
11$ git tag [tag]
xxxxxxxxxx
11$ git tag [tag] [commit]
xxxxxxxxxx
11$ git tag -d [tag]
xxxxxxxxxx
11$ git push origin :refs/tags/[tagName]
xxxxxxxxxx
11$ git show [tag]
xxxxxxxxxx
11$ git push [remote] [tag]
xxxxxxxxxx
11$ git push [remote] --tags
xxxxxxxxxx
11$ git checkout -b [branch] [tag]
xxxxxxxxxx
11$ git status
xxxxxxxxxx
11$ git log
xxxxxxxxxx
11$ git log --stat
xxxxxxxxxx
11$ git log -S [keyword]
xxxxxxxxxx
11$ git log [tag] HEAD --pretty=format:%s
xxxxxxxxxx
11$ git log [tag] HEAD --grep feature
xxxxxxxxxx
21$ git log --follow [file]
2$ git whatchanged [file]
xxxxxxxxxx
11$ git log -p [file]
xxxxxxxxxx
11$ git log -5 --pretty --oneline
xxxxxxxxxx
11$ git shortlog -sn
xxxxxxxxxx
11$ git blame [file]
xxxxxxxxxx
11$ git diff
xxxxxxxxxx
11$ git diff --cached [file]
xxxxxxxxxx
11$ git diff HEAD
xxxxxxxxxx
11$ git diff [first-branch]...[second-branch]
xxxxxxxxxx
11$ git diff --shortstat "@{0 day ago}"
xxxxxxxxxx
11$ git show [commit]
xxxxxxxxxx
11$ git show --name-only [commit]
xxxxxxxxxx
11$ git show [commit]:[filename]
xxxxxxxxxx
11$ git reflog
xxxxxxxxxx
11$ git fetch [remote]
xxxxxxxxxx
11$ git remote -v
xxxxxxxxxx
11$ git remote show [remote]
xxxxxxxxxx
11$ git remote add [shortname] [url]
xxxxxxxxxx
11$ git pull [remote] [branch]
xxxxxxxxxx
11$ git push [remote] [branch]
xxxxxxxxxx
11$ git push [remote] --force
xxxxxxxxxx
11$ git push [remote] --all
xxxxxxxxxx
11$ git checkout [file]
xxxxxxxxxx
11$ git checkout [commit] [file]
xxxxxxxxxx
11$ git checkout .
xxxxxxxxxx
11$ git reset [file]
xxxxxxxxxx
11$ git reset --hard
xxxxxxxxxx
11$ git reset [commit]
xxxxxxxxxx
11$ git reset --hard [commit]
xxxxxxxxxx
11$ git reset --keep [commit]
xxxxxxxxxx
11$ git revert [commit]
xxxxxxxxxx
21$ git stash
2$ git stash pop