blob: 5ba8ec9d82e5aa636a7a1c53698df45cba094d03 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 | #:  * `update-reset`:
#:    Fetches and resets Homebrew and all tap repositories using `git`(1) to
#:    their latest `origin/master`. Note this will destroy all your uncommitted
#:    or committed changes.
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 --force -B master origin/master
    echo
  done
}
 |