aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2016-12-20 10:17:43 +0000
committerGitHub2016-12-20 10:17:43 +0000
commit584fd64a9eba0098b23ebfdc8b2aed8b100eebb6 (patch)
tree606e5211fa144ff512ffc874e17594e0a8a265ad /Library/Homebrew
parente3844719bc01c734a054389e908c44e1fa6313e3 (diff)
parentd21f6954b647948b35da41ca8d02e80880ede2b6 (diff)
downloadbrew-584fd64a9eba0098b23ebfdc8b2aed8b100eebb6.tar.bz2
Merge pull request #1684 from MikeMcQuaid/update-reset-command
update-reset: add new command.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cmd/update-reset.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/update-reset.sh b/Library/Homebrew/cmd/update-reset.sh
new file mode 100644
index 000000000..32daffc96
--- /dev/null
+++ b/Library/Homebrew/cmd/update-reset.sh
@@ -0,0 +1,43 @@
+#: @hide_from_man_page
+#: * `update-reset`:
+#: Fetches and resets Homebrew and all tap repositories using `git`(1) to
+#: their latest `origin/master`.
+
+homebrew-update-reset() {
+ local DIR
+
+ for option in "$@"
+ do
+ case "$option" in
+ -\?|-h|--help|--usage) brew help update-reset; exit $? ;;
+ --debug) HOMEBREW_DEBUG=1 ;;
+ -*)
+ [[ "$option" = *d* ]] && HOMEBREW_DEBUG=1
+ ;;
+ *)
+ odie <<EOS
+This command updates brew itself, and does not take formula names.
+Use 'brew upgrade <formula>'.
+EOS
+ ;;
+ esac
+ done
+
+ if [[ -n "$HOMEBREW_DEBUG" ]]
+ then
+ set -x
+ fi
+
+ for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/*
+ do
+ [[ -d "$DIR/.git" ]] || continue
+ cd "$DIR" || continue
+ echo "==> Fetching $DIR..."
+ git fetch --tags --force origin
+ echo
+
+ echo "==> Resetting $DIR..."
+ git checkout -B master origin/master
+ echo
+ done
+}