Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save scootcho/fc4359de1ed0c4e2bc4405e50823538c to your computer and use it in GitHub Desktop.

Select an option

Save scootcho/fc4359de1ed0c4e2bc4405e50823538c to your computer and use it in GitHub Desktop.

Revisions

  1. @ElfSundae ElfSundae revised this gist Aug 25, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-checkout-all-branches.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    #!/bin/bash

    remote=origin ; for brname in `git branch -r | grep $remote | grep -v master | grep -v HEAD | awk '{gsub(/^[^\/]+\//,"",$1); print $1}'`; do git branch --track $brname $remote/$brname || true; done 2>/dev/null
    remote=origin ; for brname in `git branch -r | grep $remote | grep -v /master | grep -v /HEAD | awk '{gsub(/^[^\/]+\//,"",$1); print $1}'`; do git branch --track $brname $remote/$brname || true; done 2>/dev/null
  2. @ElfSundae ElfSundae revised this gist Nov 28, 2019. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions git-checkout-all-branches.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    #!/bin/bash

    remote=origin ; for brname in `git branch -r | grep $remote | grep -v master | grep -v HEAD | awk '{gsub(/^[^\/]+\//,"",$1); print $1}'`; do git branch --set-upstream-to $remote/$brname $brname; done

    remote=origin ; for brname in `git branch -r | grep $remote | grep -v master | grep -v HEAD | awk '{gsub(/^[^\/]+\//,"",$1); print $1}'`; do git branch --track $brname $remote/$brname || true; done 2>/dev/null
  3. @ElfSundae ElfSundae revised this gist Nov 27, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion git-checkout-all-branches.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    #!/bin/bash

    git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote" || true; done 2>/dev/null
    remote=origin ; for brname in `git branch -r | grep $remote | grep -v master | grep -v HEAD | awk '{gsub(/^[^\/]+\//,"",$1); print $1}'`; do git branch --set-upstream-to $remote/$brname $brname; done

  4. @ElfSundae ElfSundae revised this gist Nov 27, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-checkout-all-branches.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    #!/bin/bash

    git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote" || true; done 2>/dev/null
    git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote" || true; done 2>/dev/null
  5. @ElfSundae ElfSundae revised this gist Nov 27, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-checkout-all-branches.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1,3 @@
    #!/bin/bash

    git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote" || true; done 2>/dev/null
  6. @ElfSundae ElfSundae created this gist Nov 27, 2019.
    1 change: 1 addition & 0 deletions git-checkout-all-branches.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote" || true; done 2>/dev/null