Git衝突:commit your changes or stash them before you can merge.
今天用Git pull來更新程式碼,merge本地分支程式碼時遇到了下面的問題:
![](https://i.iter01.com/images/689dc0dcb53fa07f3b90762b997b613c0b7134fb0fefddf3770af7a7e09eeadb.png)
1.stash
通常遇到這個問題,你可以直接commit你的修改;但我這次不想這樣。
看看git stash是如何做的。
git stash
git pull
git stash pop
接下來diff一下此檔案看看自動合併的情況,並作出相應修改。
git stash: 備份當前的工作區的內容,從最近的一次提交中讀取相關內容,讓工作區保證和上次提交的內容一致。同時,將當前的工作區內容儲存到Git棧中。
git stash pop: 從Git棧中讀取最近一次儲存的內容,恢復工作區的相關內容。由於可能存在多個Stash的內容,所以用棧來管理,pop會從最近的一個stash中讀取內容並恢復。
git stash list: 顯示Git棧內的所有備份,可以利用這個列表來決定從那個地方恢復。
git stash clear: 清空Git棧。此時使用gitg等圖形化工具會發現,原來stash的哪些節點都消失了。
2.放棄本地修改,直接覆蓋之
git reset --hard
git pull
相關文章
- 解決 Git 更新本地衝突:commit your changes or stash them before you can mergeGitMIT
- Git更新本地倉庫及衝突"Commit your changes or stash them before you can merge"解決GitMIT
- git 解決衝突 —— git stash 當前修改Git
- MySQL:You must reset your password using ALTER USER statement before executing this statement.MySql
- git 解決衝突Git
- Git 解決衝突Git
- Git -- StashGit
- git pull遇到錯誤:error: Your local changes to the following files would be overwritten by merge:GitError
- git在pull時報錯You have not concluded your mergeGit
- git stash save與git stash push區別Git
- git pull 衝突解決Git
- Git衝突解決技巧Git
- git stash回退Git
- why you can be in netherland
- git-----You have not concluded your merge (MERGE_HEAD exists)解決Git
- Make sure you configure your "user.name" and "user.email" in git.AIGit
- git 解決版本衝突問題Git
- 如何解決git程式碼衝突Git
- git pull衝突的解決方案Git
- Git 衝突了怎麼辦,如何高效快速的解決程式碼衝突?Git
- 解決gerrit commit後pull發生衝突的問題MIT
- git 入門教程之衝突合併Git
- Git 解決本地遠端版本衝突Git
- 教你玩轉Git-合併衝突Git
- git合併分支並處理衝突Git
- git stash用法詳解Git
- git stash使用一則Git
- git stash 怎麼用?Git
- Two useful scenarios of git stashiOSGit
- Would you like to develop a story for your character?dev
- git-stash簡單用法Git
- git stash 引發得事故Git
- git stash 命令簡單使用Git
- git commit後如何取消commitGitMIT
- 如何克服解決Git衝突的恐懼症?(Git分支策略)Git
- 【Git】3. Git重要特性-分支操作,合併衝突詳解Git
- 【Git】合併分支報衝突怎麼解決Git
- git commit --amendGitMIT
- 如何克服解決Git衝突的恐懼症?(Git高階篇)Git