1. 程式人生 > >解決error: Your local changes to the following files would be overwritten by merge

解決error: Your local changes to the following files would be overwritten by merge

在專案裡我們一般都會把自己第一次提交的配置檔案忽略本地跟蹤
1 [[email protected] demo]$ git update-index --assume-unchanged <filename>

但是專案裡的其他人如果不小心把該配置檔案修改push到遠端倉庫之後,我們git pull程式碼的時候就會報錯

1 2 3 4 5 6 7 8 9 10 11 12 13 [[email protected] demo]$ git add . [[email protected] demo]$ git commit -m 'update:index.php' [master f8a7428] update:index.php
file changed, 1 insertion(+), 1 deletion(-) [[email protected] demo]$ git pull remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From git.oschina.net:sunzmit/thinkphp 1bc9485..c63dff3  master     -> origin
/master error: Your local changes to the following files would be overwritten by merge: config.ini

大意是:您的本地更改的檔案被合併覆蓋。並指出了會被覆蓋的檔案

解決方法:

1.撤銷本地對檔案的忽略

1 [[email protected] demo]$ git update-index --no-assume-unchanged config.ini

2.從最近的一次提交中讀取內容,備份當前的工作區的內容,將當前的工作區內容儲存到Git棧中

1 2 3 [[email protected] demo]$ git stash Saved working directory and index state WIP on master: f8a7428 update:index.php HEAD is now at f8a7428 update:index.php

3.pull遠端倉庫程式碼

1 2 3 4 [[email protected] demo]$ git pull Merge made by the 'recursive' strategy. config.ini | 2 +- file changed, 1 insertion(+), 1 deletion(-)

4.從Git棧中讀取最近一次儲存的內容,恢復工作區的相關內容

1 2 3 [[email protected] demo]$ git stash pop Auto-merging config.ini CONFLICT (content): Merge conflict in config.ini

5.修改合併

1 2 3 4 5 6 7 8 [[email protected] demo]$ vim config.ini <<<<<<< Updated upstream This is a test file!!!!!!!!!!!!!!!! ======= This is a test file >>>>>>> Stashed changes [[email protected] demo]$ cat test.txt This is a test file

<<<<<<< Updated upstream到=======中是從遠端倉庫pull下來別人的內容,=======到>>>>>>> Stashed changes中是我們本地檔案內容,現在我們可以刪除其他,只保留自己的內容This is a test file

6.把檔案回覆到最新提交的版本,會保留修改內容

1 2 3 4 5 [[email protected] demo]$ git reset HEAD config.ini Unstaged changes after reset: M config.ini [[email protected] demo]$ cat test.txt This is a test file

7.再次忽略本地跟蹤,完成!

1 [[email protected] demo]$ git update-index --assume-unchanged config.ini

8.最後不要忘記清除Git棧的備份

1 [[email protected] demo]$ git stash drop

本文永久地址:http://blog.it985.com/10665.html
本文出自 IT985部落格 ,轉載時請註明出處及相應連結。

相關推薦

解決error: Your local changes to the following files would be overwritten by merge

在專案裡我們一般都會把自己第一次提交的配置檔案忽略本地跟蹤 1 [[email protected] demo]$ git update-index --assume-unchanged <filename> 但是專案裡的其他人如果不

git pull遇到錯誤:error: Your local changes to the following files would be overwritten by merge:解決方法

error: Your local changes to the following files would be overwritten by merge: 意思是我桌上型電腦上新修改的程式碼的檔案,將會被git伺服器上的程式碼覆蓋;我當然不想剛剛寫的程式碼被覆蓋掉,看了git的手

git pull遇到錯誤:error: Your local changes to the following files would be overwritten by merge:

覆蓋 eset class 代碼更新 hang err ast div clas   今天用git pull將服務器的代碼拉到本地時,遇到錯誤,Your local changes to the following files would be overwritten by

在Linux上git pull線上倉庫代碼時,出現error: Your local changes to the following files would be overwritten by merge

chan 導致 系統權限 over local tar erro 關閉 oca 在Windows上工作時未出現過該問題,於是通過命令: git diff 查看差異,得到結果: diff --git a/start_crons.sh b/start_crons.sh o

[Git] error: Your local changes to the following files would be overwritten by merge

如果系統中有一些配置檔案在伺服器上做了配置修改,然後後續開發又新新增一些配置項的時候, 在釋出這個配置檔案的時候,會發生程式碼衝突: error: Your local changes to the following files would be overwritten

git pull遇到錯誤:error: Your local changes to the following files would be overwritten by merge

出現這個問題的原因是,我個人認為是原生代碼和伺服器程式碼衝突,本地的程式碼將會被伺服器的程式碼覆蓋掉,有兩種解決的方法: 1.保留本地修改的程式碼,並把伺服器的程式碼pull到本地 git stash git pull origin master

git merge 報錯:error: Your local changes to the following files would be overwritten by m

error log: error: Your local changes to the following files would be overwritten by merge: app/Http/Controllers/User/UserIndexController.php Plea

Git之checkout到別的分支提示Your local changes to the following files would be overwritten by checkout:

1 問題 在我自己的分支,然後切換到主分支,提示錯誤如下 Your local changes to the following files would be overwritten by checkout: ****file ****file 2

【Debug-git】error:. local changes to the following files would be overwritten by merge:.idea/misc.xml

公司、個人編譯環境可能是有某些不為人知的差異,每次用git命令pull的時候,總會遇到一些奇葩問題,比如: ...done. Resolving deltas: 100% (55/55), completed with 29 local objects. From http

git 上傳至github出現error:your local changes to the following files would to be overwritten解決辦法

git 在上傳的時候出現瞭如下錯誤,當我從dev分支切換到主分支的時候出現了這個錯誤。修改的程式碼需要覆蓋。ok,那在切換之前咱們按照提示 it 先檢視一下跟蹤的檔案的狀態 git status 結果如下: 然後我們新增一下這個檔案。 這樣,我們就可以把已經修改

git pull 錯誤:The following untracked working tree files would be overwritten by merge

seekbar change ora uil KS dex output con 方法 錯誤描述: $ git pull origin alphaFrom https://github.com/shirley-wu/HeartTrace * branch

git解決error: The following untracked working tree files would be overwritten by checkout

git解決error: The following untracked working tree files would be overwritten by checkout 2017年12月27日 12:09:50 閱讀數:1792 在IDEA中進行分支切換時,出現如此錯誤,導致無法正

Py第十九問 Your local changes would be overwritten by merge. Commit, stash or revert them to proceed.

Your local changes would be overwritten by merge. Commit, stash or revert them to proceed. 2和3分別是截圖中的兩個紅框

Git 衝突:Your local changes would be overwritten by merge. Commit, stash or revert them to proceed.

解決方案有三種:1,無視,直接commit自己的程式碼。git commit -m "your msg"2,stash    stash翻譯為“隱藏”,如下操作:git stash git pull git stash pop然後diff一下檔案,看看自動合併的情況,並作出需

Your local changes would be overwritten by merge. Commit, stash or revert them to proceed.

和同事一起使用git 。今天pull時候出現這個提示。Your local changes would be overwritten by merge. Commit, stash or revert them to proceed. 顯示。如果Pull 成功會把我修改的程式

Git Pull Failed :Your local changes would be overwritten by merge. Commit, stash or revert them

在使用git進行程式碼pull’的時候,出現下面的問題: Git Pull Failed :Your local changes would be overwritten by merge. Commit, stash or revert them ①如果你想保留剛自己寫的沒有

The following untracked working tree files would be overwritten by checkout

win article files art com ima The img 分享圖片 sourcetree拉取分支出現這個錯: The following untracked working tree files would be overwritten by checko

git pull報error: Untracked working tree file 'public/images/icon.gif' would be overwritten by merge

需要 written git pull 命令 work har nbsp ima merge error: Untracked working tree file ‘public/images/icon.gif‘ would be overwritten by merge.

The path to the driver executable must be set by the webdriver.gecko.driver system property;

pack 如果 leg ide rec sel window win find 今天安裝了webdriver後,編寫了一個測試小程序,但運行時控制臺報了這樣的錯誤: 1 Exception in thread "main" java.lang.IllegalStat

NetBeans IDE驅動報錯The path to the driver executable must be set by the web driver.chrome.driver.system property......

system32 分享 pat appdata .... log google drive exe 問題:defaulstUserDataPath=C:\\Users\\user1\\AppData\\Local\\Google\\Chrome\\User Data\\De