Skip to content

Avoid git fetch'ing all branches by default #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hjwp
Copy link

@hjwp hjwp commented Jun 27, 2025

On a repo with a significant number of remote branches, fetching all remotes takes a substantial amount of time (literal minutes in our case where there are thousands of remotes)

This changes each git fetch call to fetch only the current branch name, and has specialcase handling for the mob start --create option where we know we want to create a brand new branch.

Appreciate this might not be a problem for most people!

hjwp added 2 commits June 27, 2025 12:47
On a repo with a significant number of remote branches,
fetching all remotes takes a substantial amount of time
(literal minutes in our case, with thousands of remotes)

This changes each `git fetch` call to fetch only the current branch name.
…avoids git remote does not exist error)

Following on from the previous change,
we do not want to do a `git fetch mybranch` if we know the branch is not going to exist,
ie in the case where we are doing `--create`.
@hollesse
Copy link
Member

Hi thank you for your contribution. The tests do not successfully complete. But I even think that just fetching the current branch is not a solution. At least you would have to check for the correlated mob branch if you are on a base branch and vice versa. And even then I am not sure if that would work right now.

Could you explain to me why the repo of your Project has so many things that get fetched? I want to understand the background behind it.

@hollesse hollesse requested review from hollesse and removed request for hollesse June 27, 2025 12:54
@hjwp
Copy link
Author

hjwp commented Jun 30, 2025

thanks for taking an interest! the repo i'm working on currently has over 4000 open branches, and by way of example, had 178 merges in the last 4 hours, ie 178 branches closed/deleted. that makes the overhead of an unqualified git pull or git fetch prohibitive, hence wanting to only pull/fetch the current branch, if i can.

@hjwp
Copy link
Author

hjwp commented Jun 30, 2025

sorry for not finding the tests! I've never written any Go before so i'm finding my feet.

just fetching the current branch is not a solution. At least you would have to check for the correlated mob branch if you are on a base branch and vice versa. And even then I am not sure if that would work right now.

can you tell me a bit more about why it wouldn't work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants