Skip to content

Commit 5b7e233

Browse files
committed
submit
1 parent 875f540 commit 5b7e233

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ebooks/progit_v2.1.37.pdf

19.5 MB
Binary file not shown.

useful-git-command.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ reset命令把当前分支指向另一个位置,并且有选择的变动工作
133133
> `git revert` will create a new commit that's the opposite (or inverse) of the given SHA. If the old commit is "matter", the new commit is "anti-matter"—anything removed in the old commit will be added in the new commit and anything added in the old commit will be removed in the new commit.
134134
> This is Git's safest, most basic "undo" scenario, because it doesn't alter history—so you can now git push the new "inverse" commit to undo your mistaken commit.
135135
136-
``` bash
136+
```bash
137137
git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>…​
138138
git revert --continue
139139
git revert --quit
@@ -144,7 +144,12 @@ git revert --abort
144144
145145
(https://blog.csdn.net/u013066244/article/details/79920012) https://blog.csdn.net/u013066244/article/details/79920012
146146
147-
## Revert VS Reset
147+
# Restore
148+
分离 checkout 的功能,之前 checkout 可以切换分支,也可以恢复工作区的修改内容,现在这部分恢复修改内容由命令 restore来实现;
149+
git-restore[1] is about restoring files in the working tree from either the index or another commit. This command does not update your branch. The command can also be used to restore files in the index from another commit.
150+
151+
152+
## Revert VS Reset VS Restore
148153
149154
想象一个简单的场景,分支 A,有 c1,c2,c3,c4,c5 五次 commit 提交,后来发现 c2 提交是有问题的,需要回滚,这个时候怎么解决?
150155
方案一 使用 reset 命令
@@ -170,6 +175,7 @@ revert 可以说是就是为了这种场景而产生的,也应该是我们日
170175
171176
- 解决冲突后/获取远程最新代码后合并代码:`git merge branchname` ,将 branchname 分支上面的代码合并到当前分支
172177
- 保留该存在版本合并log:`git merge --no-ff branchname` 参数 `--no-ff` 防止 fast-forward 的提交,详情参考:[the difference](http://stackoverflow.com/questions/9069061/what-is-the-difference-between-git-merge-and-git-merge-no-ff),fast-forward:分支内容一致,指针直接移动,并未能看出分支信息
178+
173179
# Rebase
174180
Rebase 同 Merge 的结果是一样的,就是合并本地、远程的改动,但过程中还有区别。
175181
``` bash

0 commit comments

Comments
 (0)