2015-04-05 100 views
-1

我已經繼承了當前部署在活動網站上的Ruby on Rails項目。雖然我已經在Bitbucket上管理該項目的git存儲庫,但在我的服務器上運行的項目(即目錄結構和所有源文件)的實例似乎已被下載而不是克隆。將下載的項目附加到git存儲庫

如何將此實例轉換爲引用Bitbucket原點和主分支的正確git簽出?

我最初的想法是:

cd projectdir/ 
git init 
git remote add origin [email protected]:my_group/my_project.git 
git checkout master 

我測試了一下這個項目的另一個下載的實例,但這個混帳錯誤是讓我三思而後行:

error: The following untracked working tree files would be overwritten by checkout: 
    # a listing of all the files in the project... 

還有就是沒有什麼區別該項目的活動實例中的源文件以及存儲庫中主分支上的內容。不過,我想盡量減少重寫某些重要事項並搞亂這個事例的風險。我在Mac OSX上使用Apache的Phusion Passenger,並且我不介意讓Apache停下來進行更改。謝謝你的幫助。

回答

0

我前一段時間所面臨的同樣的問題,我也收到了以下

error: The following untracked working tree files would be overwritten by checkout: 
index.php 
    ...... (too many lines) 
Please move or remove them before you can switch branches. 

如果我沒記錯的話,一般的做法是隻RM文件,然後結賬。你也可以添加並存儲它們。 也許首先考慮到強制結算,如:

git checkout --force master 

此鏈接(The following untracked working tree files would be overwritten by checkout)爲我節省了很多時間!它涵蓋更多/其他細節。

祝你好運! :)

相關問題