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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, and you are right using a naming convention will solve that. I will use names like this: author/[old-branch-name]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.