Your branch is up-to-date with 'origin/master'

2020-12-25  乐帮网

git

在使用git commit时遇到错误:Your branch is up-to-date with 'origin/master',根本原因是没有建立分支或者没有指定分支的问题。可使用以下方法解决。

新建一个分支

$ git branch busbranch

切换分支

$ git checkout busbranch

重新提交你的改动提交到新分支上

$ git add . 
$ git commit -m "my test commit"

合并到主仓库中

$ git checkout master 
$ git merge busbranch

最后可以push到服务器

$ git push -u origin master

所有的命令整理如下:

eddy@test-ppc MINGW64 /e/gitee/monsys (master)
$ git commit -m "my test commit"
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
        modified:   README.md

no changes added to commit

eddy@test-ppc MINGW64 /e/gitee/monsys (master)
$ git branch busbranch

eddy@test-ppc MINGW64 /e/gitee/monsys (master)
$ git branch
  busbranch
* master

eddy@test-ppc MINGW64 /e/gitee/monsys (master)
$ git checkout busbranch
Switched to branch 'busbranch'
M       README.md

eddy@test-ppc MINGW64 /e/gitee/monsys (busbranch)
$ git add .

eddy@test-ppc MINGW64 /e/gitee/monsys (busbranch)
$ git commit -m "my test commit"
[busbranch b6cd93d] my test commit
 1 file changed, 1 insertion(+), 1 deletion(-)

eddy@test-ppc MINGW64 /e/gitee/monsys (busbranch)
$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

eddy@test-ppc MINGW64 /e/gitee/monsys (master)
$ git merge busbranch
Updating bab41d0..b6cd93d
Fast-forward
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

eddy@test-ppc MINGW64 /e/gitee/monsys (master)
$ git push -u origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 352 bytes | 352.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-5.0]
To https://gitee.com/xxxxx/monsys.git
   bab41d0..b6cd93d  master -> master
Branch master set up to track remote branch master from origin.

eddy@test-ppc MINGW64 /e/gitee/monsys (master)

原创作品,禁止转载!

相关内容:

怎么撤消Git的本地提交?

Git 如何删除本地和远程分支?

Your branch is up-to-date with 'origin/master'

'git pull'和'git fetch'有什么区别?

公众号二维码

关注我的微信公众号
在公众号里留言交流
投稿邮箱:1052839972@qq.com

庭院深深深几许?杨柳堆烟,帘幕无重数。
玉勒雕鞍游冶处,楼高不见章台路。
雨横风狂三月暮。门掩黄昏,无计留春住。
泪眼问花花不语,乱红飞过秋千去。

欧阳修

付款二维码

如果感觉对您有帮助
欢迎向作者提供捐赠
这将是创作的最大动力