Skip to content

Instantly share code, notes, and snippets.

@itsdonnix
Last active November 24, 2022 09:23
Show Gist options
  • Save itsdonnix/222421c30cfd07515a37ab32b10a88ee to your computer and use it in GitHub Desktop.
Save itsdonnix/222421c30cfd07515a37ab32b10a88ee to your computer and use it in GitHub Desktop.
Git Cheatsheet

Git Cheatsheet

Fetch all origin branches as local branches

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 pull origin --all

Push all branches to all remotes:

git remote | xargs -L1 git push --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment