1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Git中Your branch is ahead of ‘origin/master‘ by x commits的解决办法

Git中Your branch is ahead of ‘origin/master‘ by x commits的解决办法

时间:2020-02-23 01:56:37

相关推荐

Git中Your branch is ahead of ‘origin/master‘ by x commits的解决办法

@[TOC]Git中Your branch is ahead of ‘origin/master’ by x commits的解决办法

问题描述:新的全局用户名下,修改原有本地库的代码,上传时遇见的问题

在Github中修改了用户名,然后在git中重新社设置全局用户名 ```bash git config --global user.name "new username" ``` 然后修改原有的本地库代,可以通过命令

git add test.txt

提交到暂存区里,但是提交到本地库的时候会报错

想通过上传,也报错。

解决方案:

方法一:(保留代码)

git push origin

方法二:(不保留代码)

git reset --hard origin/$branch

方法三:

git fetch origin

方法四:(有没被commit或者push的文件)

git pull --rebase

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。