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

原文地址:https://www.cnblogs.com/ygyy/p/14391218.html