我正在使用git来跟踪我的一个小型网站的开发。我现在有两个分支:
master
分支,它的代码(据说)已经准备好部署了dev
分支,在那里我尝试了一些东西,直到我认为它们已经准备好部署为了习惯于在将开发提升到更多人的情况下,我通常在签出master
分支并将dev
合并到它之前,将master
分支与dev
分支合并,- so可以解决dev
分支中的任何冲突,而不是master
上的冲突。
上一次我这么做的时候,一些代码就消失了( id="all_text"
的css代码,参见下面的代码)。我认为这是因为master
分支中没有代码,而且我正在将master
代码移动到dev
分支中(但这不是我记得它的行为方式),所以我取消了合并(git reset --merge
;我在GIT1.7.0.3上),检查了master
分支并将其与dev
分支合并。同样的结果,- most的代码在#all_text
中消失了。
我不知道为什么会发生这种事。最近的更改在dev
分支上,因此它们应该在合并中合理地结转,而不是被删除。
有什么方法可以解决这个问题,而不需要手工将dev
中的文档内容复制到master
中这种丑陋的黑客行为?
发展内容(index.css)
body {
margin:0;
padding:0;
}
/* attributes for the <div> that encapsules the h1 and the encouragement */
#all_text {
position: relative;
height: 50%;
width: 70%;
margin-top:8em;
margin-left:auto;
margin-right:auto;
text-align: center;
// background-color: yellow; // Trace code to better see the design
}
h1 {
position: relative;
text-align: center;
font-size: 700%;
color: #4970A8;
/* color: #5AA0FF; */
text-shadow: 4px 4px 8px gray;
// background-color: green; // Trace code to better see the design
}
div.encouragement {
position: relative;
width: 70%;
bottom: 25px;
color: #4970A8;
font-size: 170%;
// background-color: red; // Trace code to better see the design
}
主内容(index.css)
#all_text {
position: relative;
}
h1 {
color: #4970A8;
/* color: #5AA0FF; */
text-align: center;
/* text-vertica-align: center; */
font-size: 700%;
position: relative;
top:30%;
text-shadow: 4px 4px 8px gray;
}
div.encouragement {
color: #4970A8;
text-align: center;
font-size: 150%;
/* position: absolute;
top: 5%m;
left:7%em; */
/* text-shadow: 2px 2px 8px gray; */
}
合并内容(index.css)
#all_text {
position: relative;
}
h1 {
<<<<<<< HEAD
position: relative;
text-align: center;
font-size: 700%;
color: #4970A8;
/* color: #5AA0FF; */
text-shadow: 4px 4px 8px gray;
// background-color: green; // Trace code to better see the design
}
div.encouragement {
position: relative;
width: 70%;
bottom: 25px;
color: #4970A8;
font-size: 170%;
// background-color: red; // Trace code to better see the design
=======
color: #4970A8;
/* color: #5AA0FF; */
text-align: center;
/* text-vertica-align: center; */
font-size: 700%;
position: relative;
top:30%;
text-shadow: 4px 4px 8px gray;
}
div.encouragement {
color: #4970A8;
text-align: center;
font-size: 150%;
/* position: absolute;
top: 5%m;
left:7%em; */
/* text-shadow: 2px 2px 8px gray; */
>>>>>>> master
}
#all_text{…}
部分的大部分文本发生了什么变化?
事先谢谢你。
更新:添加了合并库(根据dyng’s说明)。
运行git show $(git merge-base dev master)
会给我这样的结果:
diff --git a/www/index.css b/www/index.css
index b837a87..d8c48ef 100644
--- a/www/index.css
+++ b/www/index.css
@@ -1,25 +1,44 @@
+body {
+ margin:0;
+ padding:0;
+}
+
+/* attributes for the <div> that encapsules the h1 and the encouragement */
#all_text {
position: relative;
+ height: 50%;
+ width: 70%;
+ margin-top:8em;
+ margin-left:auto;
+ margin-right:auto;
+ text-align: center;
+
+// background-color: yellow; // Trace code to better see the design
}
+
h1 {
color: #4970A8;
/* color: #5AA0FF; */
text-align: center;
-/* text-vertica-align: center; */
+ display: inline-block;
font-size: 700%;
position: relative;
- top:30%;
+ left:0.5em;
+
text-shadow: 4px 4px 8px gray;
+
+// background-color: green; // Trace code to better see the design
}
-div.encouragement {
+span.encouragement {
color: #4970A8;
- text-align: center;
- font-size: 150%;
-/* position: absolute;
- top: 5%m;
- left:7%em; */
-/* text-shadow: 2px 2px 8px gray; */
+ font-size: 170%;
+ position: relative;
+ top: 3em;
+ right:18em;
+
+
+// background-color: red; // Trace code to better see the design
}
\ No newline at end of file
发布于 2013-12-03 08:53:58
通常,在签出主分支并将dev合并到主分支之前,我通常会将主分支与dev分支合并。
为了避免这些合并问题,最好是:
这样,您就可以在主服务器上重新应用(重基)您的更改,从而使您的dev
代码“消失”的可能性不大。
https://stackoverflow.com/questions/20343970
复制相似问题