We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3f31b63 + 2449e95 commit 08d7708Copy full SHA for 08d7708
tools/cleanup_branch.py
@@ -0,0 +1,25 @@
1
+# coding=utf-8
2
+import sys
3
+from subprocess import check_output, call
4
+
5
6
+def main(date):
7
+ output = check_output('git branch|grep -v master', shell=True)
8
+ for branch in output.split('\n'):
9
+ branch = branch.strip()
10
+ if '*' in branch:
11
+ continue
12
+ p = check_output(
13
+ 'git log --since="{0}" -s {1}'.format(date, branch), shell=True)
14
+ if not p:
15
+ call('git branch -D {}'.format(branch), shell=True)
16
+ call('git push --delete --no-verify origin {}'.format(branch),
17
+ shell=True)
18
19
20
+if __name__ == '__main__':
21
+ if len(sys.argv) != 2:
22
+ date_ = '2.weeks'
23
+ else:
24
+ date_ = sys.argv[1]
25
+ main(date_)
0 commit comments