我想在已重新排序的文件中git记录一个xml块

时间:2018-05-22 02:58:42

标签: xml git

我有一个结构

的文件
<parent>
  <child name='abc'>
    <grandchild/>
    <grandchild/>
    <grandchild/>
  </child>
  <child name='xyz'>
    <grandchild/>
    <grandchild/>
    <grandchild/>
  </child>
  ....
<parent>

前段时间我们决定对文件重新排序,但这些块保持不变。

我尝试过使用

git log -L1994,1996:myfile.xml 

这给出了以下输出,接近我正在寻找的 问题是我在追求 在当前的提交是在3784-3788行

diff --git a/myFile.xml b/myFile.xml
--- a/myFile.xml
+++ b/myFile.xml

@@ -1336,4 +1903,4 @@
-    <child name="zzxxyy" >
-      <grandChild >...</grandChild>
-      <grandChild >...</grandChild>
+    <child name="aabbcc" >
+      <grandChild attr='...'/>
+      <grandChild >...</grandChild>
+      <grandChild >...</grandChild>

commit ###
Author: fred

ABC-456 blah blah blah

diff --git a/myFile.xml b/myFile.xml
--- a/myFile.xml
+++ b/myFile.xml
@@ -283,3 +283,4 @@
     <child name="zzxxyy" >
-      <grandChild attr="..."/>
+      <grandChild >...</grandChild>
+      <grandChild >...</grandChild>

commit ###
Author: fred

ABC-123 blah blah blah

diff --git a/myFile.xml b/myFile.xml
--- a/myFile.xml
+++ b/myFile.xml
@@ -249,0 +254,3 @@
+    <child name="zzxxyy" >
+      <grandChild attr="..."/>

我希望能跟踪#34; aabbcc&#34;回到日志。

e.g。

@@ -338,4 +1903,4 @@
-    <child name="aabbcc" >
-      <grandChild attr='...'/>
-      <grandChild >...</grandChild>
-      <grandChild >...</grandChild>
+    <child name="aabbcc" >
+      <grandChild attr='...'/>
+      <grandChild >...</grandChild>
+      <grandChild >...</grandChild>

但我希望我的要求太多了。

使用git版本2.12.2

0 个答案:

没有答案