Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #!bash
  2. # This script goes into every subfolder, sniff for all local branches and try to pull from git repo.
  3. # Finally returns back to current branch.
  4. ls -d */ | while read repo
  5. do
  6. echo "Switch to $repo"
  7. cd "$repo"
  8. current_branch=$(git rev-parse --abbrev-ref HEAD)
  9. echo "current branch: $current_branch"
  10. git stash && git branch --format='%(refname:short)'|
  11. while read lbranch
  12. do
  13. git checkout "$lbranch" && git pull
  14. done
  15. echo "switch back to $current_branch"
  16. git checkout "$current_branch"
  17. cd ..
  18. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement