2013-09-24 29 views
1

已經運行以下命令:Git的變基顯示錯誤,搞砸了重訂基期日誌

git init 
touch README 
git add README 
git commit -m "Initial Commit" 
git branch b01_02_03 
git checkout b01_02_03 
echo "Data 1" >> f1 && git add f1 && git commit -m "Add 01" 
echo "Data 2" >> f2 && git add f2 && git commit -m "Add 02" 
echo "Data 3" >> f3 && git add f3 && git commit -m "Add 03" 
git checkout master 
git branch b04_05 
git checkout b04_05 
echo "Data 4" >> f4 && git add f4 && git commit -m "Add 04" 
echo "Data 5" >> f5 && git add f5 && git commit -m "Add 05" 
git checkout master 
git merge --ff-only b01_02_03 
git checkout b04_05 

,形成如下測試樹:

* 8294414 (HEAD, b04_05) add 05 
* 19f920f add 04 
| * 3a2ca64 (master, b01_02_03) add 03 
| * 49d1aca add 02 
| * c8f6d30 add 01 
|/ 
* 7f0ca8e initial commit 

我跑

git rebase master 

並獲取以下輸出。

First, rewinding head to replay your work on top of it... 
Applying: add 04 
/opt/swt/install/git-1.7.12.3/libexec/git-core/git-am: line 115: /home9/tclarke/git-puzzles-1/.git/rebase-apply/next: cannot overwrite existing file 
/opt/swt/install/git-1.7.12.3/libexec/git-core/git-am: line 665: 1: cannot overwrite existing file 
/opt/swt/install/git-1.7.12.3/libexec/git-core/git-am: line 666: 1: cannot overwrite existing file 
/opt/swt/install/git-1.7.12.3/libexec/git-core/git-am: line 712: 1: cannot overwrite existing file 
Applying: add 04 
/opt/swt/install/git-1.7.12.3/libexec/git-core/git-am: line 115: /home9/tclarke/git-puzzles-1/.git/rebase-apply/next: cannot overwrite existing file 

結果是:

* c88b1f0 (HEAD, b04_05) add 04 
* 761c779 add 04 
* 3a2ca64 (master, b01_02_03) add 03 
* 49d1aca add 02 
* c8f6d30 add 01 
* 7f0ca8e initial commit 

成功的底墊,但日誌搞砸了,登錄 「加05」 變爲與它的前身。這可以在不同的文件空間中的另一臺機器上重複,我已經創建了一個新的git存儲庫。我的鄰居對同一棵樹沒有同樣的問題。

有關如何解決此問題的任何建議?

+0

你檢查過,這不僅僅是一個簡單的文件權限問題嗎? –

+0

我很確定它就是這樣。怪異的位是有問題的文件:/home9/tclarke/git-puzzles-1/.git/rebase-apply/next似乎是由rebase本身創建和銷燬的,所以當我嘗試時它根本不存在並檢查其權限。 – deworde

+0

你的umask設置了什麼?是否有可能取消自己對文件的寫入權限(例如,0222的umask)? – torek

回答

0

出於某種原因,某些回購元文件的權限可能是錯誤的。

首先,嘗試在本地倉庫的主路徑(/home9/tclarke/git-puzzles-1)中運行chmod -R u+rw .git,然後查看是否存在吊牌。 (即使是這樣,也要做下一步)。

接下來,確保遠程回購被初始化爲共享。在回購的遠程位置(你需要爲這個shell訪問),看看config文件,並說明是否根據[core]節,你有這樣一行:

sharedrepository = 1 

如果它缺少,添加它,然後運行chmod -R g+w /path/to/repo(並且還在[receive]下添加denyNonFastforwards = true)。

最後,確保沒有其他進程已經鎖定您本地回購的元文件(不能想到這會發生的原因,但仍然)。運行lsof | grep -F /home9/tclarke/git-puzzles-1/.git,看看你是否想出任何東西。

+0

啊,我應該提到的事情,這完全在我的本地回購(我正在嘗試進行重新設計練習)。 – deworde

+0

@deworde你在另一臺機器上提到了一個新的結賬,它對你的鄰居有效。所以你有一個遠程回購你從克隆? –

+0

我明白你的意思了。這是一個非常罕見的克隆,然後我們重新初始化並去除了遙控器,所以它基本上使我們達到了它只是一個已知狀態的回購,但與原始來源沒有關係。 我應該給一個真正自制的本地在同一個州看看我是否得到相同的效果。 – deworde