error: cannot pull with rebase: You have unstaged changes.

最近提交代码出现了好多次提交不上的情况

Your branch is up to date with 'origin/master'.
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.

根据提示进行

git stash

但还是有问题,最后折腾了半天发现是以前的一次错误提交引起的,总算是解决了。

  • 方法
  1. 切换到项目的顶层目录
git chekcout .

把所有的改动全部删除

2.删除贬低代码时的附加改动(生成的文件等)

git clean -fd
  1. 拉取代码
git pull

但此时有报错

Already up to date.

It seems that there is already a rebase-apply directory, and
I wonder if you are in the middle of another rebase.  If that is the
case, please try
        git rebase (--continue | --abort | --skip)
If that is not the case, please
        rm -fr "xxxxxxxxxxxxxxxxx/.git/rebase-apply"
and run me again.  I am stopping in case you still have something
valuable there.

找到了问题的根源

rm -fr "xxxxxxxxxxxxxxxxx/.git/rebase-apply"
  1. 切换到 .git 目录
cd .git
  1. 执行
rm -fr rebase-apply/

6.返回刚才的目录(顶层目录)

 cd ../

7.重新拉取代码

git pull
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值