为什么git警告我我的分支已经偏离了主分支?
我正在为LibreOffice做贡献,并开始学习git。我已经克隆了LibreOffice存储库并获得了成功的构建。LibreOffice有19个git存储库,1个命名为bootstrap,其余一个级别较低,命名为writer、calc、postprocess、base等。它有一个脚本maned为什么git警告我我的分支已经偏离了主分支?,git,libreoffice,Git,Libreoffice,我正在为LibreOffice做贡献,并开始学习git。我已经克隆了LibreOffice存储库并获得了成功的构建。LibreOffice有19个git存储库,1个命名为bootstrap,其余一个级别较低,命名为writer、calc、postprocess、base等。它有一个脚本manedg,用于在所有存储库中同时运行git命令,而不是单独运行 克隆之后,我创建了一个补丁,该补丁被推送到远程存储库中。此时,我的所有更改都已提交(即,git diffoutputs nothing),状态是我
g
,用于在所有存储库中同时运行git命令,而不是单独运行
克隆之后,我创建了一个补丁,该补丁被推送到远程存储库中。此时,我的所有更改都已提交(即,git diff
outputs nothing),状态是我在主分支之前提交
现在,当我运行/g pull-r
时,我得到以下输出:
victor@victor-laptop:~/git/libo$ ./g pull -r
===== main repo =====
Current branch master is up to date.
===== artwork =====
Current branch master is up to date.
===== base =====
Current branch master is up to date.
===== calc =====
Current branch master is up to date.
===== components =====
Current branch master is up to date.
===== extensions =====
Current branch master is up to date.
===== extras =====
Current branch master is up to date.
===== filters =====
Current branch master is up to date.
===== help =====
Current branch master is up to date.
===== impress =====
Current branch master is up to date.
===== libs-core =====
Current branch master is up to date.
===== libs-extern =====
Current branch master is up to date.
===== libs-extern-sys =====
Current branch master is up to date.
===== libs-gui =====
From http://anongit.freedesktop.org/git/libreoffice/libs-gui
08137a2..d314277 master -> origin/master
First, rewinding head to replay your work on top of it...
Fast-forwarded master to d3142771895c2e9ce029e3b52af7f1ea1b437a6b.
===== postprocess =====
Current branch master is up to date.
===== sdk =====
Current branch master is up to date.
===== testing =====
Current branch master is up to date.
===== ure =====
Current branch master is up to date.
===== writer =====
U sw/source/core/doc/docdesc.cxx
U sw/source/core/frmedt/fews.cxx
M sw/source/core/inc/SwXMLBlockExport.hxx
U sw/source/core/inc/UndoCore.hxx
U sw/source/core/inc/ascharanchoredobjectposition.hxx
U sw/source/core/inc/frame.hxx
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
和git status
显示:
victor@victor-laptop:~/git/libo$ cd sw
victor@victor-laptop:~/git/libo/sw$ git diff
diff --cc sw/source/core/doc/docdesc.cxx
index 0900b18,52b984e..0000000
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@@ -216,7 -216,7 +216,11 @@@ void SwDoc::ChgPageDesc( sal_uInt16 i,
if( rChged.GetNumType().GetNumberingType() != pDesc->GetNumType().GetNumbe
{
pDesc->SetNumType( rChged.GetNumType() );
++<<<<<<< HEAD
+ // den Seitennummernfeldern bescheid sagen,
++=======
+ // Bug 64121 - den Seitennummernfeldern bescheid sagen,
++>>>>>>> Removal of bogus comments in writer module
// das sich das Num-Format geaendert hat
GetSysFldType( RES_PAGENUMBERFLD )->UpdateFlds();
GetSysFldType( RES_REFPAGEGETFLD )->UpdateFlds();
diff --cc sw/source/core/frmedt/fews.cxx
index 6fe4bf0,4dc82ff..0000000
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@@ -1266,6 -1267,7 +1266,10 @@@ Size SwFEShell::GetGraphicDefaultSize(
return aRet;
}
++<<<<<<< HEAD
++=======
+ // add output parameter <bVertL2R>
++>>>>>>> Removal of bogus comments in writer module
sal_Bool SwFEShell::IsFrmVertical(const sal_Bool bEnvironment, sal_Bool& bRTL,
{
sal_Bool bVert = sal_False;
diff --cc sw/source/core/inc/UndoCore.hxx
index e8fda05,99f4722..0000000
--- a/sw/source/core/inc/UndoCore.hxx
+++ b/sw/source/core/inc/UndoCore.hxx
@@@ -133,6 -133,7 +133,10 @@@ class SwUndoFmtColl : public SwUndo, pr
void DoSetFmtColl(SwDoc & rDoc, SwPaM & rPaM);
public:
++<<<<<<< HEAD
++=======
+ // SwUndoFmtColl( const SwPaM&, SwFmtColl* );
++>>>>>>> Removal of bogus comments in writer module
SwUndoFmtColl( const SwPaM&, SwFmtColl*,
const bool bReset,
const bool bResetListAttrs );
@@@ -202,6 -203,7 +206,10 @@@ public
virtual void RepeatImpl( ::sw::RepeatContext & );
};
++<<<<<<< HEAD
++=======
+ //--------------------------------------------------------------------
++>>>>>>> Removal of bogus comments in writer module
const int nUndoStringLength = 20;
diff --cc sw/source/core/inc/ascharanchoredobjectposition.hxx
index 16dde41,2f868a9..0000000
--- a/sw/source/core/inc/ascharanchoredobjectposition.hxx
+++ b/sw/source/core/inc/ascharanchoredobjectposition.hxx
@@@ -140,7 -140,7 +140,11 @@@ namespace objectpositionin
Point GetAnchorPos() const;
// calculated relative position to base line for object position ty
++<<<<<<< HEAD
+
++=======
+
++>>>>>>> Removal of bogus comments in writer module
SwTwips GetRelPosY() const;
// determined object rectangle including spacing for object position
diff --cc sw/source/core/inc/frame.hxx
index 664f28b,94db9cc..0000000
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@@ -248,6 -250,9 +248,12 @@@ enum MakePageTyp
MAKEPAGE_NOSECTION // Don't create section frames
};
++<<<<<<< HEAD
++=======
+ // #i28701# - replaced by new class <SwSortedObjs>
+ //typedef SdrObject* SdrObjectPtr;
+ //SV_DECL_PTRARR(SwDrawObjs,SdrObjectPtr,1,1);
++>>>>>>> Removal of bogus comments in writer module
class SwFrm: public SwClient, public SfxBroadcaster
{
(END)
victor@victor-laptop:~/git/libo/clone/writer$ git status
# Not currently on any branch.
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: sw/source/core/inc/SwXMLBlockExport.hxx
#
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: sw/source/core/doc/docdesc.cxx
# both modified: sw/source/core/frmedt/fews.cxx
# both modified: sw/source/core/inc/UndoCore.hxx
# both modified: sw/source/core/inc/ascharanchoredobjectposition.hxx
# both modified: sw/source/core/inc/frame.hxx
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# 0001-Removal-of-bogus-comments-in-writer-module.patch
victor@victor-笔记本电脑:~/git/libo/clone/writer$git状态
#目前不在任何分支上。
#要提交的更改:
#(使用“git重置磁头…”取消分级)
#
#修改:sw/source/core/inc/SwXMLBlockExport.hxx
#
#未合并路径:
#(使用“git重置磁头…”取消分级)
#(酌情使用“git add/rm…”标记分辨率)
#
#两者都已修改:sw/source/core/doc/docdesc.cxx
#两者都已修改:sw/source/core/frmedt/fews.cxx
#两者都已修改:sw/source/core/inc/UndoCore.hxx
#两者都已修改:sw/source/core/inc/ascharanchoredobjectposition.hxx
#两者都已修改:sw/source/core/inc/frame.hxx
#
#未跟踪的文件:
#(使用“git add…”包含在将提交的内容中)
#
#0001-remove-of-bogus-comments-in-writer-module.patch
如果我试图通过手动编辑这些文件来解决冲突,git会告诉我我的master与origin/master有分歧。这种情况持续一个周期。请帮帮我。问题可能是什么?我如何解决
为什么git警告我我的分支已经偏离了主分支
Git正在警告您,您的分支已从主分支发散,因为您的分支已从主分支发散
如果我理解正确,首先您在master
(我们称之为a
)的基础上创建了一个新的提交(我们称之为B
)。Git正确地说,您比origin
的master
早一个提交
A---B
同时,其他人在origin
的master
上添加了新的提交:
A---B
\
C---D---E
此时,您的主控
和原点
的主控
发生分歧。您有一个origin/master
没有的提交,而origin/master
有3个您没有的提交。其中一个可能是您发送的补丁(我在您的git status
输出中看到了由git format patch
创建的文件,所以我猜您是作为补丁发送的);应用补丁不会创建完全相同的提交(至少提交者名称和时间戳会不同)
当您执行git pull
时,git必须将您的提交(B
)与您没有的提交合并,创建一个合并提交(我们称之为F
):
请再次注意,origin/master
没有您的提交(B
和F
)。如果有人将新提交添加到origin/master
,则必须再次合并
现在,如何摆脱这种局面?有几种方法。一种是将您的更改推送到源站
,这样现在它就拥有了您所拥有的一切。另一种方法是放弃提交并将主控
重置为源/主控
。第三种方法是在origin/master
之上重新设置提交的基础
A---B
如果我猜对了,您通过电子邮件通过git格式补丁
发送了更改,并且这些更改已经应用,那么最好的解决方法是将master
重置为origin/master
。为了避免将来出现此问题,最好在从上游提取更改之前,在单独的分支中工作,并切换回master
为什么git警告我我的分支已经偏离了主分支
Git正在警告您,您的分支已从主分支发散,因为您的分支已从主分支发散
如果我理解正确,首先您在master
(我们称之为a
)的基础上创建了一个新的提交(我们称之为B
)。Git正确地说,您比origin
的master
早一个提交
A---B
同时,其他人在origin
的master
上添加了新的提交:
A---B
\
C---D---E
此时,您的主控
和原点
的主控
发生分歧。您有一个origin/master
没有的提交,而origin/master
有3个您没有的提交。其中一个可能是您发送的补丁(我在您的git status
输出中看到了由git format patch
创建的文件,所以我猜您是作为补丁发送的);应用补丁不会创建完全相同的提交(至少提交者名称和时间戳会不同)
当您执行git pull
时,git必须将您的提交(B
)与您没有的提交合并,创建一个合并提交(我们称之为F
):
请再次注意,origin/master
没有您的提交(B
和F
)。如果有人将新提交添加到origin/master
,则必须再次合并
现在,如何摆脱这种局面?有几种方法。一种是将您的更改推送到源站
,这样现在它就拥有了您所拥有的一切。另一种方法是放弃提交并将主控
重置为源/主控
。第三种方法是在origin/master
之上重新设置提交的基础
A---B
如果我猜对了,您是通过git forma通过电子邮件发送更改的