Loading

Github远程推送一直Everything up-to-date

问题描述:

Github远程推送一直Everything up-to-date,但其实并没有推送成功,远程库中没有更新文件

可能原因分析及解决方法:

  1. "git push with no additional arguments only pushes branches that exist in the remote already. If the remote repository is empty, nothing will be pushed. In this case, explicitly specify a branch to push, e.g. git push master."

    这种情况表明可能是忘了commit

  2. git提交改动到缓存,要push的时候不会将本地所有的分支都push掉,所以可能是没有指定提交的分支,我们应该告诉git提交哪个分支;
    【按以下步骤】:

    $ git branch newbranch  //先创建一个新分支提交改动
    $ git branch   //输入这条命令检查是否创建成功
     这时输出:  
        newbranch
        master
    //这样就创建成功了,前面的*代表的是当前你所在的工作分支。我们接下来就要切换工作分支
    $ git checkout newbranch    //切换工作分支
    //将改动提交到新的分支上
    $ git add .  
    $ git commit -a  
    $ git checkout master      //接下来就要回主分支了
    $ git merge newbranch       //将新分支提交的改动合并到主分支上
    $ git push -u origin master     //接下来重新push代码
    //新建分支现在没用了,删除分支
    $ git branch -D newbranch 

    关于2的原文链接:https://blog.csdn.net/myhuashengmi/article/details/52197566

  3. 若按2执行还是不行,此时也有可能是因为合并分支更新了代码,但没有提交,导致缓存区没有刷新文件信息,此时可以尝试在主分支下重新提交改动:

    $ git add .  
    $ git commit -a  

    然后重新push即可;

posted @ 2018-06-17 00:07  sinatJ  阅读(947)  评论(0编辑  收藏  举报