[gitHub实践] git基础:远程仓库的使用

[gitHub实践] git基础:远程仓库的使用

版权2019.6.2更新

  • git 基础

    1. 远程仓库的使用

      # 添加远程仓库
      $ git remote add
      ```

      • git fetch [remote-name]

        # 从远程仓库中抓取与拉取
        # git fetch origin 会抓取新推送的所有工作,不会合并或者修改当前工作
        
        # git pull 自动抓取远程分支到当前分支,git clone 命令会自动设置本地master分支跟踪克隆的远程仓库master分支。
      • git push [remote-name] [branch-name]

        # 推送到远程仓库
        # 多人合作时,要求先拉取合并,再推送
      • git remote show [remote-name]

        # 查看远程仓库(更多信息)
        $ git remote show
        origin
        $ git remote show origin
        * remote origin
          Fetch URL: https://github.com/pengwill/eduSystem.git
          Push  URL: https://github.com/pengwill/eduSystem.git
          HEAD branch: master
          Remote branches:
            cfj    tracked
            dev_tp tracked
            master tracked
          Local branch configured for 'git pull':
            master merges with remote master
          Local ref configured for 'git push':
            master pushes to master (local out of date)
      • git remote rename

        # 重命名远程仓库的简写名
        $ git remote rename old new
      • git remote rm

        # 移除远程仓库
        $ git remote rm new

|版权声明:除特别注明外,本博客所有文章均为博主T.P原创,转载请注明出处:https://www.cnblogs.com/tp0829/p/10963165.html

猜你喜欢

转载自www.cnblogs.com/tp0829/p/10963165.html