2014-05-19 79 views
4

我剛剛安裝了Gerrit,我想對它進行推送,但是我收到了有關Change-Id的錯誤,但它似乎存在於它抱怨的提交中。將Change-Id添加到所有提交

$ git push gerrit HEAD:refs/publish/my-branch 
Counting objects: 28, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (15/15), done. 
Writing objects: 100% (15/15), 4.46 KiB, done. 
Total 15 (delta 12), reused 0 (delta 0) 
remote: Resolving deltas: 100% (12/12) 
remote: Processing changes: refs: 1, done  
remote: ERROR: missing Change-Id in commit message footer 
remote: Suggestion for commit message: 
remote: Revert "Refactoring controllers" 
remote: 
remote: This reverts commit dd1c5c86b12461f61326fd102a11d9e3cb51142e. 
remote: 
remote: Change-Id: Iaacf80a9e4f56b58d0b648112c3eb2413988f00e 
remote: 
remote: Hint: To automatically insert Change-Id, install the hook: 
remote: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 [email protected]:hooks/commit-msg ${gitdir}/hooks/ 
remote: 
remote: 
To ssh://[email protected]:29418/Project 
! [remote rejected] HEAD -> refs/publish/my-branch (missing Change-Id in commit message footer) 
error: failed to push some refs to 'ssh://[email protected]:29418/Project' 

我認爲,這是因爲以前的提交是沒有Change-Id,因爲他們之前有鉤製成。我如何更新所有以前的提交以添加Change-Id

+1

導入存儲庫時,通常會推送給主服務器,而不是推送審閱。 – uncletall

回答

2

在Gerrit中 - 在項目設置頁面中禁用需要臨時提交change-Id的選項。然後將現有的提交推送到Gerrit。

+0

然後我可以安全地啓用它嗎? – stackular

+1

是 - 啓動回購後 - 然後設置此選項 – HiB

+1

請注意,如果某人修改了這些提交併推回來,它們將作爲新更改打開;爲了防止這種情況,必須從Gerrit UI手動將change-id複製到提交消息。 – Smar

1

當你有鉤,你可以做衍合分支到自己在交互模式

git checkout branchName 
git rebase -i branchName 

當你看到交互式菜單更改關鍵字pickedit附近的每一個承諾,你有沒有變化ID。然後,git將在「重新綁定」每一個標記爲edit的提交之前停止。每做一次你就做git commit --amend,保存更改(如果你已經提交了hook hrom gerrit,那麼你需要手動添加更改ID),然後git rebase --continue。之後,您的分支中的每個提交都將具有change-id。
Rince並重復你需要的每一個分支。

相關問題