请先提交您的更改或将其存储在合并之前 [英] Please commit your changes or stash them before you merge

查看:57
本文介绍了请先提交您的更改或将其存储在合并之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想升级,但是我需要提交,但是当我执行git commit时,我得到了:

I want to upgrade, but I need to commit, but when I do git commit, I get:

您的分支落后起源/发展" 20次提交,并且可以快速转发.

Your branch is behind 'origin/develop' by 20 commits, and can be fast-forwarded.

(使用"git pull"更新您的本地分支)

(use "git pull" to update your local branch)

我不想丢失本地更改

推荐答案

从您的项目目录中使用这些终端命令.

Use these terminal commands from your project directory.

使用git stash存储本地更改.在本地中的最后一次提交之后,这会将您的本地更改保存到堆栈中.

Stash your local changes using git stash. This will save your local changes, after the last commit in your local, to a stack.

如果要从除master以外的分支中拉出,请使用git pullgit pull <remote-name> <branch-name>从远程拉动更改.这样会将提交从远程分支拉到您没有的本地.

Pull changes from remote using git pull or git pull <remote-name> <branch-name> if you are pulling from branch other than master. This will pull the commits from the remote branch to local that you don't have.

使用git stash pop从存储中弹出更改.这将套用未提交的更改.这可能会导致代码中的合并冲突.

Pop back your changes from stash using git stash pop. This will apply back the uncommitted changes. This may result in merge conflicts in your code.

您可以在解决冲突后提交更改.

You can commit the changes after resolving the conflicts.

您也可以存储更改而不进行隐藏,但这也可能导致合并冲突,必须解决.

You could also pull changes without stashing, but that may too result in merge conflicts, which you have to resolve.

这篇关于请先提交您的更改或将其存储在合并之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆