文章目录
Cannot rebase:You have unstaged changes
原因:说明你有修改过的文件,未提交
对于git rebase理解:合并提交记录
这个命令执行以下三步:
1.把你修改的本地仓库的内容,取出来放到暂存区(stash)(保证工作区的干净)
2.然后从远端拉取代码到本地,由于工作区干净,所以不会有冲突
3.从暂存区把你之前提交的内容取出来,跟拉下来的代码合并
所以rebase在拉代码前要保证你的本地工作区是干净的,如果你本地修改的内容没完全commit 或者stash,就会rebase失败
解决办法:
执行以下命令:
git stash
git rebase
git push
执行git文件夹已经存在但没上传成功
1.直接上传
git status
cd ..
git add .
git commit -m 'add'
hongtu push
2.随便编辑一个空格,上传
cd ..
git add .
git commit -m 'add'
hongtu push
git status 出现 rebase in progress; on to ****
撤销rebase, 执行后本地内容会回到提交之前的状态
git rebase --abort
git rebase : You are not currently on a branch
git branch 获取branch的名字
git checkout (branch's name)
git pull
git rebase
git push
参考:
https://blog.csdn.net/jiangyu1013/article/details/78852594
https://www.cnblogs.com/sjhsszl/p/8709003.html