Skip to content

Commit a4d0e82

Browse files
add git
1 parent 75e5b68 commit a4d0e82

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

note/git教程.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,74 @@ git tag -d v1.4-lw
297297

298298
```
299299
300+
---
301+
302+
# 常用
303+
* 拉取远程非master分支
304+
305+
```
306+
git clone [email protected]:zhaozhengcoder/CoderNoteBook.git
307+
308+
git checkout -b feature/dev-test origin/feature/dev-test
309+
```
310+
311+
* 更新分支
312+
313+
```
314+
更新master
315+
git pull origin master
316+
317+
更新feature/dev-test分支 (远程分支和本地分支名一致)
318+
切换到对应的分支在操作
319+
git pull origin feature/dev-test
320+
321+
如果远程分支名和本地分支名不一致的话
322+
git pull origin origin_branch:local_branch
323+
git pull origin feature/dev-test:feature/dev-test
324+
```
325+
326+
* 如果更新的时候,出现冲突(本地也该了,远程也改了)
327+
328+
```
329+
$ git status
330+
On branch master
331+
Your branch is ahead of 'origin/master' by 2 commits.
332+
(use "git push" to publish your local commits)
333+
334+
You have unmerged paths.
335+
(fix conflicts and run "git commit")
336+
(use "git merge --abort" to abort the merge)
337+
338+
Unmerged paths:
339+
(use "git add <file>..." to mark resolution)
340+
341+
both modified: readme.txt
342+
343+
no changes added to commit (use "git add" and/or "git commit -a")
344+
```
345+
346+
```
347+
手动修改冲突的文件,然后
348+
git add readme.md (冲突的文件名)
349+
```
350+
351+
* 提交本地修改到远程分支
352+
353+
```
354+
git push origin feature/dev-test
355+
356+
如果本地分支和远程分支名不一致
357+
git push origin feature/dev-test:feature/dev-test
358+
```
359+
360+
* 查看某个commit id的改动
361+
362+
```
363+
git show 2580fba
364+
```
365+
366+
-------
367+
300368
## 参考
301369
302370
- [廖雪峰教程](https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000)

0 commit comments

Comments
 (0)