File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ Git是一个“分布式版本管理工具”,简单的理解版本管理工
86
86
* [ clone下来指定的单一分支] ( #clone下来指定的单一分支 )
87
87
* [ 忽略某个文件的改动] ( #忽略某个文件的改动 )
88
88
* [ 忽略文件的权限变化] ( #忽略文件的权限变化 )
89
- * [ 展示本地所有的分支的commit ] ( #展示本地所有的分支的commit )
89
+ * [ 以最后提交的顺序排序Git分支 ] ( #以最后提交的顺序排序Git分支 )
90
90
* [ 在commit log中查找相关内容] ( #在commit-log中查找相关内容 )
91
91
* [ 把暂存区的指定file放到工作区中] ( #把暂存区的指定file放到工作区中 )
92
92
* [ 强制推送] ( #强制推送 )
@@ -273,7 +273,13 @@ git revert <commit-id>
273
273
## 回到某个commit的状态,并删除后面的commit
274
274
和revert的区别:reset命令会抹去某个commit id之后的所有commit
275
275
``` sh
276
- git reset < commit-id>
276
+ git reset < commit-id> # 默认就是-mixed参数。
277
+
278
+ git reset –mixed HEAD^ # 回退至上个版本,只保留源码,回退commit和index信息
279
+
280
+ git reset –soft HEAD~3 # 回退至三个版本之前,只回退了commit的信息,不会恢复到**暂存区**一级。如果还要提交,直接commit即可
281
+
282
+ git reset –hard < commit-id> # 彻底回退到指定commit-id的状态,本地的源码也会变为上一个版本的内容
277
283
```
278
284
279
285
## 修改上一个commit的描述
@@ -505,8 +511,8 @@ git update-index --no-assume-unchanged path/to/file
505
511
git config core.fileMode false
506
512
```
507
513
508
- ## 展示本地所有的分支的commit
509
- 最新的放在最上面
514
+ ## 以最后提交的顺序排序Git分支
515
+ 最新的放在最上面
510
516
511
517
``` sh
512
518
git for-each-ref --sort=-committerdate --format=' %(refname:short)' refs/heads/
@@ -520,6 +526,7 @@ git log --all --grep='<given-text>'
520
526
```
521
527
522
528
## 把暂存区的指定file放到工作区中
529
+ 不添加参数,默认是-mixed
523
530
``` sh
524
531
git reset < file-name>
525
532
```
You can’t perform that action at this time.
0 commit comments