關於這個問題有很多問題,但他們似乎都指的是什麼時候有遠程更改。對我來說並非如此。Git拒絕推送(在遠程對方後面)
$ git push repo master
...
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart.
$ git fetch repo master
$ git diff repo/master
<single commit I've done locally>
是,git pull
讓我來推,但我需要做的更多或更少的每一次什麼是錯的。
編輯:
繼RUP的評論我檢查的樣子在gitk --all
,它看起來像我的遠程分流了。所以,這很奇怪。
檢查,看看我是否有本地提交:
$ git branch -r --contains 48673b311730fdfcf71b0e5776f6180c5173df42
origin/master
$ git branch --contains 48673b311730fdfcf71b0e5776f6180c5173df42
所以,顯然我有一個遠程提交,在回購只有我才能訪問,我沒有在本地有。我只用一臺電腦,那個提交不可能來自這臺電腦和我之外的任何地方。我很困惑。
編輯2: 因此,遵循Javabrett的答案,我冒險進入reflogs。
d022f6d [email protected]{144}: pull bt master:
41a6f50 [email protected]{145}: pull bt master: checkout 41a6f50f7e3e96723f0d1c222205645d78a504db
48673b3 [email protected]{146}: commit: Added commented out urls to .env
14948e3 [email protected]{147}: rebase finished: returning to refs/heads/master
14948e3 [email protected]{148}: pull bt master: checkout 14948e3c4dd014bb5af7293fdee6772a9e605b6f
其中bt是共享回購。我最好的猜測是,我推到了我的私人回購站,但是從共享回購站下來,我將其重新分配到bt/master,並且原始提交「消失」。因爲歷史不會同步,所以再次推入私人會觸發拒絕。那對嗎?
聽起來好像您的更改已被推送到遠程。 'git pull'應該快速前進。 – thirtythreeforty
嘗試使用'gitk --all'來查看本地和遠程分支之間的確切關係 – Rup
發佈本地和遠程最近提交的日誌。 – javabrett