Reset local branches to remote during `shelf_mirror_from_git`.
Chris Pressey
1 year, 7 months ago
468 | 468 | fi |
469 | 469 | } |
470 | 470 | |
471 | _shelf_reset_branches() { | |
472 | branches=`git branch | sed 's/[* ]//g'` | |
473 | for branch in $branches; do | |
474 | echo "git branch -f $branch origin/$branch" | |
475 | git branch -f $branch origin/$branch || return 0 | |
476 | done | |
477 | return 1 | |
478 | } | |
479 | ||
471 | 480 | shelf_mirror_from_git() { |
472 | 481 | git_prefix="$1" |
473 | 482 | while read -r line; do |
480 | 489 | if [ ! -d $dest ]; then |
481 | 490 | git clone --mirror $url $dest |
482 | 491 | fi |
483 | (echo -n "$dest: " && cd $dest && git remote set-url origin $url && git remote update) | |
492 | (echo -n "$dest: " && cd $dest && _shelf_reset_branches && git remote set-url origin $url && git remote update) | |
484 | 493 | done |
485 | 494 | } |
486 | 495 |