zoukankan      html  css  js  c++  java
  • Git-远程仓库的使用

    Git修改远程仓库地址

      1.修改命令
      git remote set-url origin [url]

      例如:$ git remote set-url origin gitlab@gitlab.chumob.com:php/hasoffer.git

      2.先删后加

      git remote rm origin
      git remote add origin [url]

    Git查看远程仓库的名称和对应的克隆地址

      1.查看远程仓库的名称

      git remote

      2.查看远程仓库的克隆地址

      git remote -v

    Git添加远程仓库

      git remote add [shortname] [url]

      例如:$ git remote add pb git://github.com/paulboone/ticgit.git

      解释: pb指代对应的仓库名称,我们如果推送到远程仓库,就可以选择pb这仓库,git push pb master 这样就推送到 远程pb仓库的master分之了。

    Git查看远程仓库信息

      git remote show [remote-name]

      例如:$ git remote show origin

        * remote origin
          Fetch URL: https://gitee.com/huayicompany/think-in-java-4th.git
          Push URL: https://gitee.com/huayicompany/think-in-java-4th.git
          HEAD branch: master
          Remote branch:
            master tracked
          Local branch configured for 'git pull':
            master merges with remote master
          Local ref configured for 'git push':
            master pushes to master (up to date)

    Git删除远程仓库和重命名

      1. 删除远程仓库

      git remote rm [repository name]

      2.重命名远程仓库

      git remote rename [old name] [new name]

     Git 推送远程仓库

      git push [repository name] [branch name]

    Git 拉取远程仓库

      git pull [repository name] [branch name] 或者

      git fetch

      解释:git pull 会自动合并远程仓库的内容到本地仓库,fetch不会自动合并

    Git查看远程与本地的差异

      git fetch origin

      git diff master origin/master --minimal

    参考:

    [1] 网络教程, https://git-scm.com/book/zh/v1/Git-%E5%9F%BA%E7%A1%80-%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%E7%9A%84%E4%BD%BF%E7%94%A8

  • 相关阅读:
    paramiko使用
    requests防止中文乱码
    RESTful架构
    关于pandas
    echarts基础使用
    跨站请求伪造CSRF原理
    js将方法作为参数调用
    Newtonsoft.Json解析json字符串和写json字符串
    图片压缩
    sql去重
  • 原文地址:https://www.cnblogs.com/happyflyingpig/p/7833387.html
Copyright © 2011-2022 走看看