本文介绍了如何从存储中通过分支创建者进行git提取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用命令时:



git fetch



我是获得所有在远程机器上创建的不在本地机器上的分支。



但我只想获取我自己创建的远程分支。 默认情况下, 与上游回购协议相关的是

  [remoteorigin] 
url = https://github.com/schacon/simplegit-progit
fetch = + refs / heads / *:refs / remotes / origin / *

这就是为什么您会收到很多远程追踪分支。



您可以修改/添加新提取的refspecs,如。



如果你有一个命名约定允许y ou来确定你创建的分支是什么,你可以使用一个模式来获取这些分支。



但是你不能根据分支的创建者因为Git不记录谁创建了分支。


when I use the command:

git fetch

I am getting all the branch created on the remote which are not on my local machine.

But I only want to fetch the remote branches that I created myself.

解决方案

By default, the refspec associated to an upstream repo is

[remote "origin"]
    url = https://github.com/schacon/simplegit-progit
    fetch = +refs/heads/*:refs/remotes/origin/*

That is why you are getting many remote tracking branches.

You can modify/add new refspecs for the fetch, as seen in "Can I specify in .git/config to fetch multiple refspecs?".

If you have a naming convention which allows you to determine what are the branches you have created, you can use a pattern to fetch only those.

But you cannot fetch based on the "creator" of a branch, since Git doesn't record who created a branch.

这篇关于如何从存储中通过分支创建者进行git提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 15:30