[GitHub practice] git basis: using a remote repository

[GitHub practice] git basis: using a remote repository

Copyright 2019.6.2 update

  • git basis

    1. Using a remote repository

      # Add a remote repository
      $ 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

| Copyright: Unless otherwise stated, all articles in this blog are bloggers TP original, please indicate the source: https://www.cnblogs.com/tp0829/p/10963165.html

Guess you like

Origin www.cnblogs.com/tp0829/p/10963165.html