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
  • 43,109
  • 15
  • 131
  • 205
t31321
  • 763
  • 1
  • 7
  • 22

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,262,500
  • 529
  • 4,410
  • 5,250
  • 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