2014-09-01 82 views
4

下面是發生的情況(我想這是我的問題是如何出現的,但不是100%肯定):的Git/Github上:已提交迷路了

  • 有人發送了PR,我沒有合併,但後來我恢復它,使用Github上revert按鈕
  • 他與同犯另一PR(加一個改正錯誤)
  • 我它合併(使用Github上merge按鈕)
  • 已經在被還原的提交第一個公關已經消失紅色從主回購!

爲什麼會發生這種情況?現在怎麼可能呢,從做PR的叉子,它的意思是There isn't anything to compare,雖然那些提交不在遠程回購的分支原件上。

最後,我該如何恢復那些提交?

編輯:按照要求,這裏是我的git log有趣的面值:

* | | 25f28fb Merge branch 'FooUser-develop' into develop 
|\ \ \ 
| * \ \ 73768b7 Merge branch 'develop' of https://github.com/FooUser/mainRepo into FooUser-develop 
| |\ \ \ 
| | * | | 2e61235 Invert adresses 
* | | | | d522031 Merge branch 'develop' of https://github.com/mainUser/mainRepo into develop 
|\ \ \ \ \ 
| |////
|/| | | | 
| * | | | 1e6e61b Merge pull request #946 from mainUser/revert-945-develop 
| |\ \ \ \ 
| | * | | | 6767f03 (origin/revert-945-develop) Revert "Corrections" 
| |////
| * | | | 5ccc9cd Merge pull request #945 from FooUser/develop 
| |\ \ \ \ 
| | |/// 
| | * | | 6e0c08b Corrections structuration 
| | * | | f7ade9b Correction 
| | * | | 4844437 Nb to Str 
| | * | | 1729a83 Fix adress 
| | * | | ceab88d Corrections: @ssert 
| | * | | a3c8d1a #891 Fix 
| |/// 

我顯然失去大部分的第一個提交的(#891 Fix爲例)。

搜索的更多一點,我發現的例子,我在a3c8d1a增加了一些文件(第一次提交)被正確合併上73768b7(倒數第二) - 他們不僅僅是beore,在d522031,由於恢復 - 但然後消失25f28fb(最後一個)

編輯2: 我認爲問題是因爲叉不同步(當我接受他的公關,然後恢復它時,他沒有混合拉/合併)。我怎麼能阻止呢? (順便「修復」它,我不得不櫻桃挑選所有提交失蹤..)

+0

你能爲我們提供'git的日誌--graph --oneline --decorate --all'從你的倉庫? – 2014-09-01 13:28:38

+0

還有很多其他的提交,我會盡量清理一下! – Bonswouar 2014-09-01 13:37:10

+1

只是最後10次提交應該足以更好地瞭解情況。只需在前面的命令中加上-10即可。 – 2014-09-01 13:39:29

回答