Browse Source

mfprune: fetch remotes, offer checkout option

Scott Lahteine 7 years ago
parent
commit
06f4776be4
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      buildroot/share/git/mfprune

+ 7
- 2
buildroot/share/git/mfprune View File

@@ -6,6 +6,11 @@
6 6
 # Great way to clean up your branches after messing around a lot
7 7
 #
8 8
 
9
+echo "Fetching latest upstream and origin..."
10
+git fetch upstream
11
+git fetch origin
12
+echo
13
+
9 14
 echo "Pruning Merged Branches..."
10 15
 git branch --merged | egrep -v "^\*|RC|RCBugFix|dev" | xargs -n 1 git branch -d
11 16
 echo
@@ -14,9 +19,9 @@ echo "Pruning Remotely-deleted Branches..."
14 19
 git branch -vv | egrep -v "^\*|RC|RCBugFix|dev" | grep ': gone]' | gawk '{print $1}' | xargs -n 1 git branch -D
15 20
 echo
16 21
 
17
-echo "You may want to remove these remote tracking references..."
22
+echo "You may want to remove (or checkout) these refs..."
18 23
 comm -23 \
19 24
   <(git branch --all | sed 's/^[\* ] //' | grep origin/ | grep -v "\->" | awk '{ print $1; }' | sed 's/remotes\/origin\///') \
20 25
   <(git branch --all | sed 's/^[\* ] //' | grep -v remotes/ | awk '{ print $1; }') \
21
-  | awk '{ print "git branch -d -r origin/" $1; }'
26
+  | awk '{ print "git branch -d -r origin/" $1; print "git checkout origin/" $1 " -b " $1; }'
22 27
 echo

Loading…
Cancel
Save