Skip to content

Commit 54cd15c

Browse files
add git
1 parent 68480f4 commit 54cd15c

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

note/git教程.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ git status
7575
无文件要提交,干净的工作区
7676
```
7777

78+
79+
撒销一个合并
7880
```
79-
# 把版本库里面对应的版本退回到工作区
81+
# 如果你觉得你合并后的状态是一团乱麻,想把当前的修改都放弃,你可以用下面的命令回到合并之前的状态
82+
git reset --hard HEAD
8083
git reset --hard commit_id
8184
```
8285

@@ -85,6 +88,7 @@ git reset --hard commit_id
8588
git status
8689
git status -s
8790
git log
91+
git log --stat
8892
```
8993

9094

@@ -112,6 +116,25 @@ git checkout dev
112116
git checkout -b dev
113117
```
114118

119+
合并分支:
120+
121+
```
122+
# 如果要在master分支合并dev分支,那么在切换到master的分支之后,就可以合并dev分支
123+
git merge dev
124+
```
125+
126+
删除分支:
127+
```
128+
git branch -d (branchname)
129+
```
130+
131+
## git diff
132+
133+
用git diff来找你当前工作目录和上次提交与本地索引间的差异。
134+
```
135+
git diff
136+
```
137+
115138
## .gitignore
116139

117140
首先,在你的工作区新建一个名称为.gitignore的文件。
@@ -126,14 +149,22 @@ git checkout -b dev
126149
*.out
127150
```
128151

152+
## git的工具
153+
```
154+
# 很漂亮的图形的显示项目的历史
155+
gitk
156+
```
157+
129158
## 参考
130159

131-
https://gist.github.com/285571052/72fe4e85290d170b9de4634b6ad8c082
160+
- [廖雪峰教程](https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000)
161+
162+
- [cyc_git教程](https://github.com/CyC2018/CS-Notes/blob/master/docs/notes/Git.md)
132163

133-
https://git-scm.com/book/zh/v2
164+
- [runoob教程](http://www.runoob.com/git/git-workspace-index-repo.html)
134165

135-
https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
166+
- [具体的每一个git命令的使用](https://www.yiibai.com/git/git_diff.html)
136167

137-
https://github.com/CyC2018/CS-Notes/blob/master/docs/notes/Git.md
168+
https://gist.github.com/285571052/72fe4e85290d170b9de4634b6ad8c082
138169

139-
http://www.runoob.com/git/git-workspace-index-repo.html
170+
https://git-scm.com/book/zh/v2

0 commit comments

Comments
 (0)