git pull ../mortoray-main/ mortoray-main
这将从其他仓库提取并合并
mortoray-main
分支到当前仓库的当前分支中。
我要找的是如何设置相应的快捷方式,以便我可以只需执行以下操作:git pull mortoray
在我的gitconfig中添加了以下内容:
[remote "mortoray"]
url = ../mortoray-main/
fetch = mortoray-main
现在的问题是,当我运行
git pull mortoray
时,会出现错误:“您要从远程'mortoray'拉取,但未指定分支。因为这不是当前分支的默认配置的远程,所以您必须在命令行上指定一个分支。”如何配置远程以使快捷方式像原始pull命令一样工作?请注意,以下命令可以代替'git pull mortoray',但显然不是快捷方式:
git fetch mortoray
git merge FETCH_HEAD
这正是使用“远程”之外的方法所做的事情:
git pull ../mortoray-main/ mortoray-main
所以问题是关于快捷方式的,我想要一个拉取命令,它可以像原始的拉取命令一样为我执行获取和合并操作。
git pull mortoray
有没有任何配置可以使这个快捷键按预期工作?
git pull
命令中指定你的本地分支:git pull mortoray-main yourBranch
。 - VonC