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 dbc5675 + 86f4128 commit 27d30f3Copy full SHA for 27d30f3
contrib/git-clean.sh
@@ -0,0 +1,32 @@
1
+#!/bin/bash
2
+# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
3
+# $COPYRIGHT$
4
+#
5
+# Additional copyrights may follow
6
7
+# $HEADER$
8
9
+# Trivial helper script to git clean a tree and all of its submodules.
10
+
11
+set -euo pipefail
12
13
+# Top git dir
14
+root=$(git rev-parse --show-toplevel)
15
+cd $root
16
17
+# Clean the top-level dir
18
+echo "=== Cleaning top-level git directory"
19
+git clean -dfx .
20
21
+submodule_dirs=$(git submodule status | awk '{print $2}')
22
+if test -z "$submodule_dirs"; then
23
+ echo "No submodules to clean"
24
+ exit 0
25
+fi
26
27
+for dir in $submodule_dirs; do
28
+ echo "=== Cleaning submodule: $dir"
29
+ cd $dir
30
+ git clean -dfx .
31
+ cd $root
32
+done
0 commit comments