How do I fetch all branches? #9

Closed
opened 2025-12-30 12:45:57 +00:00 by jadudm · 1 comment
Owner

I want to have references/all branches locally.

I want to have references/all branches locally.
Author
Owner

This will want to be expanded over time. The short version might be:

git fetch --all
git pull --all

to just get the references, but it might be necessary to do:

git branch -r \
  | grep -v '\->' \
  | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" \
  | while read remote; do \
      git branch --track "${remote#origin/}" "$remote"; \
    done
git fetch --all
git pull --all

source: https://stackoverflow.com/a/10312587

This will want to be expanded over time. The short version might be: ``` git fetch --all git pull --all ``` to just get the references, but it might be necessary to do: ``` git branch -r \ | grep -v '\->' \ | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" \ | while read remote; do \ git branch --track "${remote#origin/}" "$remote"; \ done git fetch --all git pull --all ``` source: https://stackoverflow.com/a/10312587
jadudm added the git label 2025-12-30 12:49:56 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jadudm/how-to-do-computer-things#9