为拉取远程分支定义git别名

5
我最近开始在工作流程中添加git别名,但还没有弄清楚如何处理以下情况。 每天多次使用git pull git@github.com:Matt-Dionis/angular2-tour-of-heroes.git将最新的远程分支合并到本地的master。 我想做的是指定一个别名,例如git pull latest-tour,其中latest-tour指的是那个ssh地址。是否有办法实现这个目标呢?

2
git remote add latest-tour git@github.com:Matt-Dionis/angular2-tour-of-heroes.git - Jeff Puckett
1
有很多方法可以做到这一点,但我会选择@JeffPuckettII所说的方法:只需将它们添加为远程,然后您就可以从中获取git fetch,使用git log latest-tour/master查看提交,合并和/或变基等。 - torek
1个回答

1

正如Git基础-使用远程仓库所述,您可以添加多个远程仓库。默认情况下,git pull/fetch将使用名为origin的远程仓库。
但是,您随时可以从任何其他定义的远程仓库获取。

Jeff Puckett所述:

 git remote add latest-tour git@github.com:Matt-Dionis/angular2-tour-of-heroes.git 
 git fetch latest-tour

你可以从不同的远程仓库和分支pull代码:
git push latest-tour master

这是一个本地别名吗?还是添加到仓库供他人使用的? - eran otzap
1
@eranotzap 是远程名称,也就是本地配置设置,你可以在 <path/to/my/local/repo>/.git/config 中看到。它是本地的,仅对你的本地存储库有效,而不适用于其他人。 - VonC

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接