美文网首页
git commit提示Your branch is up-to

git commit提示Your branch is up-to

作者: web_jianshu | 来源:发表于2021-03-24 14:31 被阅读0次

今天提交git仓库的时候,遇到了如截图所示的问题,提示Your branch is up-to-date with 'origin/master'.

image

查了些资料后,发现其根本原因是版本分支的问题

这时候我们就需要新建一个分支
git branch newbranch  

然后检查分支是否创建成功

git branch 

会有如下提示(前面的*代表的是当前你所在的工作分支)

image
然后切换到你的新分支
git checkout newbranch

如果不放心,还可以 $ git branch确认下

然后将你的改动提交到新分支上

git add . 
git commit -m "18.03.01"
然后git status检查是否成功
image
然后切换到主分支
git checkout master 

然后将新分支提交的改动合并到主分支上

git merge newbranch  

然后就可以push代码了

git push -u origin master

最后还可以删除这个分支

git branch -D newbranch

END

合并起来执行

git branch newbranch; git checkout newbranch; git add .; git commit -m "2021-3-24"; git checkout master; git merge newbranch; git push -u origin master; git branch -D newbranch;

相关文章

网友评论

      本文标题:git commit提示Your branch is up-to

      本文链接:https://www.haomeiwen.com/subject/ydchhltx.html