簡體   English   中英

重新建立基礎后,本地分支顯示在遠程分支的前面

[英]Local branch shown ahead of remote branch after rebasing

每次我重新建立本地分支的基礎時, git status顯示以下內容:

# On branch --blah--
# Your branch is ahead of 'origin/--blah--' by 11 commits.

只有在我推送到分支(實際上並沒有推送任何內容)之后,它才說“ Everything up-to-date

這是奇怪的行為,我懷疑我缺少一些基本知識。 為什么會這樣呢?

git rebase origin/branch作用是將您的工作放在本地副本中的origin/branch分支的頂部。

當你有:

local_branch: 1--2--3--4--1'--2'--3'
remote_branch: 1--2--3--4--a--b--c 

然后通過發出git rebase remote_branch你最終會

local_branch: 1--2--3--4--a--b--c--1'--2'--3'
remote_branch: 1--2--3--4--a--b--c 

這意味着當前您的local_branch實際上是您基於其進行遠程操作的一些提交。

之后git push將導致

local_branch: 1--2--3--4--a--b--c--1'--2'--3'
remote_branch: 1--2--3--4--a--b--c--1'--2'--3'

這樣您的當地人就可以保持最新狀態

查看git-rebase文檔

暫無
暫無

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

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