• git学习小结(未完待续)


    错误一

    Updates were rejected because the remote contains work that you do

     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'https://github.com/icessun/baiduWebShool.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    

    错误的原因是:远程仓库包含你本地所没有的更新,可能是被其他人推送进去,故你应该合并这些变化在你准备推送之前


    解决办法:

    $ git pull origin master     抓取远端的内容
    $ git push origin master     重新推送到远程仓库

    错误二

    Your local changes to the following files would be overwritten by checkout:

    Administrator MINGW32 /d/blog (dev)
    $ git checkout master
    error: Your local changes to the following files would be overwritten by checkout:
            .idea/workspace.xml
    Please commit your changes or stash them before you switch branches.
    Aborting
    

    错误的原因是:直接在远程仓库包操作了,修改了github上面的东西,相当于服务器上面的东西,而本地没有修改,当想改变分支的时候,出现了改变分支的时候会重写文件,所以必须把修改的提交到版本库里面。或者是隐藏在你切换分支之前。


    解决办法:

    • 抛弃本地的修改,回到上一个版本

      git reset --hard
      然后,切换你的分支
      git checkout master 
  • 相关阅读:
    16进制字符串的转换
    UINavigationBar统一修改导航条样式
    3D touch
    WKWebView
    CAEmitterLayer 粒子效果(发射器)
    SDWebImage下载图片的使用
    PHP之string之str_shuffle()函数使用
    Redis之hiredis API (String)
    Redis之数据类型Sting字符串
    PHP之string之str_repeat()函数使用
  • 原文地址:https://www.cnblogs.com/linewman/p/9918382.html
Copyright © 2020-2023  润新知