git暫存本地修改


在使用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
e28cb8870961418204e82894a1e0fe6e.png

這樣本地的所有修改就都被暫時存儲起來 。是用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

意思就是系統自動合並修改的內容,但是其中有沖突,需要解決其中的沖突。

 

 

 

轉:https://blog.csdn.net/weixin_42641385/article/details/113629831?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-0&spm=1001.2101.3001.4242


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM