git command

Git commands

Often used commands:

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
### 创建
git clone <link> <dir>
git init


### 互动
git status
git add <file>
git commit -m <message>
git commit -m -a <message>


### 分支
git branch # 列出分支
git branch <branch name> # 创建
git branch -d <brach name> # 删除

git checkout <branch name> # 转移
git checkout -b <branch name> # 创建并转移

git merge <branch name> # 合并

### 记录
git log

### 同步
git pull # 同步且merge至当前branch
git fetch # 仅同步
0%