Skip to content

Instantly share code, notes, and snippets.

@darktef
Last active December 31, 2016 04:02
Show Gist options
  • Save darktef/5aa7a9261e15470eb0cf83693a06ee93 to your computer and use it in GitHub Desktop.
Save darktef/5aa7a9261e15470eb0cf83693a06ee93 to your computer and use it in GitHub Desktop.
Fish - fetch all git branches
for remote in (git branch -r | grep -v HEAD)
// remove the origin/
set bran (string replace -r 'origin\/' '' $remote)
// remove the left trailing white spaces
set br (string trim -l $bran)
set r (string trim -l $remote)
// create branch local to track the origin/branch
git branch --track $br $r
end
// to update all the branch
git fetch --all
// http://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches
// it has to be some better way to do this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment