为一个分支添加另一个远端

Tags
git
Created
Aug 16, 2018 3:38 AM

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

查看所有远端:git remote -v

查看远端:git remote show <remote name>

添加远端:git remote add <remote name> <remote name address>

设置 upstream branch: git push -u <remote name> <branch name>

添加 remote 可以在原仓库的基础上新建自己的仓库(另外也可以通过修改远端地址来实现):

  • clone:添加自己的仓库作为另一个 remote
  • fork(推荐,github 中能显示原仓库):添加原仓库作为另一个 remote // 之后可以拉取合并到自己项目
SuperMade with Super