1

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.

Alexis King
  • 40,717
  • 14
  • 119
  • 194
t31321
  • 673
  • 1
  • 6
  • 20

1 Answers1

1

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.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Thanks, and you are right using a naming convention will solve that. I will use names like this: author/[old-branch-name] – t31321 Dec 08 '14 at 08:08