簡體   English   中英

如果我在提交后拉取,為什么 git push 通知數量會增加 SourceTree 中的單個提交

[英]Why git push notification number increases for a single commit in SourceTree if I took pull after commit

MRE:

  1. 使用我們的代碼庫配置 SourceTree。
  2. 您應該在我們 CodeBase 的遠程存儲庫后面至少進行 1 次提交。
  3. 不要拉,直接提交任何文件。
  4. 您將在 ST 的 git push 按鈕中看到1通知。
  5. 現在,拉一下。
  6. 請注意,git 按鈕中的數字更改為2

有人可以告訴我為什么嗎? 那個數字代表否。 提交,或其他什么?

拉取可能導致合並提交,將您擁有的本地更改與 1 個遠程更改合並。

--------------L local
--------------R  remote

拉后

--------------LM local
               /
--------------R  remote

您現在比遠程提前 2 次提交 (LM),您的原始更改 + 與遠程合並。 即使您的內容現在已與遙控器同步。

另一種方法是執行 pull-rebase,這將重寫您的本地歷史記錄以在遠程重播您的更改:

---------------L local
--------------R  remote

在 pull-rebase 之后:

--------------RN local
--------------R  remote

L 將被重寫為將 R 作為父代,並將導致新的本地提交 (N)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM