2012-12-06 24 views
3

我有一個Gerrit安裝,其中有幾個相關的項目(每個都在git倉庫中)。另一個項目即將上線也會使用gerrit,但爲了整潔起見,我希望把現有的一系列項目放在一個新的超級項目之下(以便在頂層可以看到「傘」項目。我還想保留我們對此的數據(例如,評論歷史)。如何在Gerrit中獲取幾個頂級項目並將它們移到另一個「容器」項目下?

我們如何去做這樣的事情?另一種看待這種情況的方法是,如何移動一個子 - 項目從一個超級項目到另一個?

回答

3

感謝this blog post我偶然發現了這個早晨格里特,我發現到解決方案了堅實的路徑!雖然它不完全簡單,它的強大,它的工作原理。

確保你已經創建了這個總括項目,你將重新爲這個子項目做父母,並執行以下步驟:

MYGERRIT=ssh://${MYGERRIT_IP}:${MYGERRIT_PORT} 

mkdir ~/x 
cd ~/x 

# Clone the repo for the subproject you want to re-parent 
git clone ${MYGERRIT}/<subproject> 
cd <subproject> 

git fetch origin refs/meta/config:refs/remotes/origin/meta/config 
git checkout meta/config 

# Make changes to project.config 
-----> inheritFrom = <your_umbrella_project_name> 

# Commit changes 
git add -A 
EDITOR=vi git commit -a 

# Push changes 
git push origin meta/config:meta/config # If pushing directly 
#git push origin meta/config:refs/for/meta/config # If going through gerrit 

# Flush gerrit caches 
ssh -p ${MYGERRIT_PORT} ${MYGERRIT_IP} gerrit flush-caches --cache project_list 
ssh -p ${MYGERRIT_PORT} ${MYGERRIT_IP} gerrit flush-caches --cache projects 
+0

Awsome,謝謝! – palacsint

相關問題