标签:https rev xxx starting commit hang tor ati star
使用了好多命令, 但对于 git revert 一直不敢怎么使用, 为什么呢?
因为 git merge 的存在.
每次 对于 git merge 的分支, 执行 git revert xxx 分支的时候总是报错. 没有细追.
今天同事恰好问道了这个问题. 于是追了一下.
主要就是对于 -m 命令. 查看了一下,其中对于
git revert -m
解释如下
-m parent-number, --mainline parent-number
Usually you cannot revert a merge because you do not know which side of the merge should be considered the mainline. This option specifies the
parent number (starting from 1) of the mainline and allows revert to reverse the change relative to the specified parent.
Reverting a merge commit declares that you will never want the tree changes brought in by the merge. As a result, later merges will only bring
in tree changes introduced by commits that are not ancestors of the previously reverted merge. This may or may not be what you want.
See the revert-a-faulty-merge How-To[1] for more details.
正常使用的话, 那么直接执行
git revert xxx(具体的某次提交的 SHA-1)
如果有某次merge的话
git revert -m 1 xxx (具体的某次提交)
这里的 1 是什么意思呢?
运行 git log 后, 当前的提交信息一般如下
commit
其中的 merge 第一个就是 1, 第二个就是 2, 依次计算;
一个比较好的参考地址如下:
how to revert-a-faulty-merge
标签:https rev xxx starting commit hang tor ati star
原文地址:https://www.cnblogs.com/asdfq/p/9297427.html