在使用git pull代碼時,經常會碰到有沖突的情況,提示如下信息:
Your branch is behind 'origin/master' by 123 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Please, commit your changes or stash them before you can merge.
這個意思是說更新下來的內容和本地修改的內容有沖突,先提交你的改變或者先將本地修改暫時存儲起來。
一.處理的方式非常簡單,主要是使用git stash命令進行處理,分成以下幾個步驟進行處理。---- 通常用這種方法
1、先將本地修改存儲起來
$ git stash

這樣本地的所有修改就都被暫時存儲起來 。是用git stash list可以看到保存的信息:
it stash暫存修改
其中stash@{0}就是剛才保存的標記。
2、pull內容
暫存了本地修改之后,就可以pull了。
$ git pull
3、還原暫存的內容
$ git stash pop stash@{0}
系統提示如下類似的信息:
Auto-merging c/environ.cCONFLICT (content): Merge conflict in c/environ.c
意思就是系統自動合並修改的內容,但是其中有沖突,需要解決其中的沖突。