Git的常用命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
git init
git config user.name xxx
git config user.email xxx@qq.com
git config --global user.name xxx
git config --global user.email xxx@qq.com
git status
git add [filename]
git commit -m "commit message" [file name]
git log
git log --pretty=oneline
git log --oneline
git reflog
git reset --hard [局部索引值]
git reset --hard HEAD^
git reset --hard HEAD~1
git diff [文件名]
git diff [本地库中的历史版本] [文件名]
git branch [新建的分支名]
git branch -v
git checkout [要切换的分支名]
git merge [有新内容的分支名]
git remote -v
git remote add [别名] [远程地址]
git push [别名] [本地分支名]
git clone [远程地址]
git fetch [远程库地址别名] [远程分支名]
git merge [远程库地址别名/远程分支名]
git pull [远程库地址别名] [远程分支名]
ssh-keygen -t rsa -C GitHub用户的邮箱
git remote add origin_ssh [远程仓库的ssh地址]