2017-02-24 42 views
0

嘿,我正在嘗試將我的更改拉到服務器我使用的是Ubuntu服務器。當我試圖運行git拉我收到此錯誤:Rails 5 git pull給出錯誤

e error: Your local changes to the following files would be overwritten by merge: 
Gemfile.lock 
Please, commit your changes or stash them before you can merge. 
Aborting 

我已經試過的git的復位 - 硬,然後再拉我得到這個錯誤,當我試圖使用rm以刪除文件Gemfile.lock的-rf Gemfile.lock它不會刪除文件。我不知道如何讓git pull工作。

回答

0

選項1:如果你想拋開你以前所做的更改提交

git stash 
git pull 

,如果你想擁有國家拉動(可能導致合併衝突)之前,着手:

git stash apply 

選項2:如果你想申請你以前所做的更改提交

git commit -m "I edited this blahblah file" 
git pull 

e error: Your local changes to the following files would be overwritten by merge: Gemfile.lock Please, commit your changes or stash them before you can merge. Aborting

是因爲您在尚未提交的跟蹤文件中有更改。所以git希望你先提交它(如果你想保留你之前提交的修改)或者把你的修改放到一個臨時的位置(隱藏),以便狀態返回到前面的提交

+0

我得到:錯誤:您的本地更改到下列文件將被合併覆蓋: \t Gemfile.lock 這當我git拉和git存儲應用 – user2480754

0

按照這些命令和你將很好去

git stash 
git pull origin <branch_name> 
git stash pop 

這將完成這項工作。 讓我知道你是否仍然面臨這個問題。