当您在多个函数之上有 docblocks 时,删除一个函数会创建一个次优补丁。
索引.js:
/**
* Function foo description.
*/
function foo() {}
/**
* Function bar description.
*/
function bar() {}
Run Code Online (Sandbox Code Playgroud)
删除函数 foo 及其文档块会生成以下补丁:
diff --git a/index.js b/index.js
index f4e18ef..933004f 100644
--- a/index.js
+++ b/index.js
@@ -1,9 +1,4 @@
/**
- * Function foo description.
- */
-function foo() {}
-
-/**
* Function bar description.
*/
function bar() {}
Run Code Online (Sandbox Code Playgroud)
这意味着任何合并带来的提交触及函数 foo 和函数 bar 之间的空间现在都会导致冲突。例如,假设我们feature-1在删除 foo 之前创建了一个分支,并在两者之间index.js添加了一个函数foobar。冲突如下:
/**
<<<<<<< HEAD
=======
* Function …Run Code Online (Sandbox Code Playgroud)