1

私は LibreOffice に貢献しており、git の学習を開始しました。LibreOffice リポジトリのクローンを作成し、ビルドに成功しました。LibreOffice には、bootstrap という名前の 19 の git リポジトリ 1 があり、1 レベル下に writer、calc、postprocess、base などの名前が残っていますg。git コマンドを個別に実行するのではなく、すべてのリポジトリで同時に実行するスクリプトが用意されています。

クローン作成後、リモート リポジトリにプッシュされるパッチを作成しました。この時点で、すべての変更がコミットされ (つまりgit diff、何も出力されません)、ステータスはマスター ブランチより先にコミットされたということです。

実行すると、次の./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'.

これは、書き込みモジュール (sw) のいくつかのファイルに問題があることを示しています。言及されているファイルは、私が提供したパッチで使用されているものからのものです。

git diffこれを示しています:

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)

そしてこれをgit status示します:

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

これらのファイルを手動で編集して競合を解決しようとすると、git はマスターが origin/master から分岐したことを通知します。この状況が周期的に続きます。私を助けてください。何が問題で、どうすれば解決できますか?

4

1 に答える 1

1

私のブランチが master から分岐したことを git が警告するのはなぜですか?

Git は、ブランチが master から分岐したため、ブランチが master から分岐したことを警告しています。

私が状況を正しく理解していれば、最初に (これを と呼びましょうB) の上に新しいコミット (と呼びましょmasterう) を作成しましたAoriginGit は、あなたが の 1 つ前のコミットであると正しく言いますmaster

A---B

その間、他の人がoriginの上に新しいコミットを追加しましたmaster:

A---B
 \
  C---D---E

この時点で、masterとは分岐していますorigin。持っていないmasterコミットが1つあり、持っていないコミットが3つあります。これら 3 つのうちの 1 つは、あなたが送信したパッチである可能性もあります (あなたの出力にによって作成されたファイルが表示されているので、パッチとして送信したと推測されます)。パッチを適用してもまったく同じコミットは作成されません (少なくともコミッター名とタイムスタンプは異なります)。origin/masterorigin/mastergit format-patchgit status

を実行するgit pullと、git はコミット ( B) を持っていないコミットとマージし、マージ コミットを作成する必要があります (これを と呼びましょうF):

A---B-------F
 \         /
  C---D---E

origin/master繰り返しになりますが、コミットがないことに注意してください (BそしてF今回は)。誰かが に新しいコミットを追加した場合はorigin/master、再度マージする必要があります。

さて、この状況から抜け出すにはどうすればよいでしょうか?いくつかの方法があります。1 つは、変更を にプッシュするoriginことです。もう 1 つは、コミットを放棄して にリセットするmasterことorigin/masterです。3 つ目は、コミットを の上にリベースすることですorigin/master

変更を 経由でメールで送信し、変更が既に適用されていると私が正しく推測しているgit format-patch場合、あなたの場合の最善の方法は、 にリセットするmasterことorigin/masterです。将来この問題を回避するには、別のブランチで作業し、masterアップストリームから変更をプルする前に元に戻すことをお勧めします。

于 2011-06-12T21:49:31.077 に答える