• git删除远程仓库文件


    1 首先将远程代码pull到本地,保持本地仓库跟远端仓库同步

    git pull git@github.com:lanleilin/lanGallery.git//使用SSH的方式

    2 然后使用git rm命令删掉要删除的文件

    git rm readme.md

    3 删除之后,本地目录下已经删除的文件夹就不再存在了,为了能将远程仓库的相应文件也删除掉,我们要把这次操作提交到上去

    git commit -m "remove markdown"

    4然后将更改push到远程

    git push

    其他git方法:

    1 git 删除和版本回退:

    首先删除: git rm '*' //删除全部

    然后git log 查看版本日志

    然后git reset --hard 123456回到具体版本

    git删除文件夹以及其目录下文件:git rm myJs -r -f

    2 远程强制回到某版本:

    先reset到某版本,然后

    git push -f

     3 git中出现 Please enter a commit message to explain why this merge is necessary.

                    git 在pull或者合并分支的时候有时会遇到这个界面。可以不管(直接下面3,4步),如果要输入解释的话就需要:

                                1.按键盘字母 i 进入insert模式

                                2.修改最上面那行黄色合并信息,可以不修改

                                3.按键盘左上角"Esc"

                                4.输入":wq",注意是冒号+wq,按回车键即可

    4 pull request操作

    > git checkout -b survey           # 在本地创建 survey 分支,并切换到分支 survey
    > git add *                 # 添加修改
    > git commit -m " modified *** file" # 本地提交
    
    > git push origin survey            # 在origin (远)端,创建survey 分支,并将本地的survey 分支内容 push 到远端的 origin/survey分支
    > git branch -a                       # (非必要命令)查看远端分支创建是否成功

    然后在网页端开启pull request请求合并分支

     删除分支:git branch -D survey

    5 解决冲突

      指定本地dev分支与远程origin/dev分支的链接    

      $ git branch --set-upstream dev origin/dev

      $ git pull
      
      $git status 查看冲突,删除冲突文件 重新提交
      $ git add readme.txt 
      $ git commit -m "conflict fixed"
     

    https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013760174128707b935b0be6fc4fc6ace66c4f15618f8d000

  • 相关阅读:
    Spring缓存注解@Cache使用
    Java中BigDecimal的8种舍入模式
    mysql和oracle的mybatis操作
    MyEclipse开发JAX-RS架构WebServices收发JSON数据格式
    Hibernate 常见异常
    SQL笔试题
    Map按键排序(sort by key)
    Spring+Mybatis常见问题随笔
    md5utils
    Http请求中Content-Type讲解以及在Spring MVC中的应用
  • 原文地址:https://www.cnblogs.com/rlann/p/7197454.html
Copyright © 2020-2023  润新知