mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-01-08 19:53:41 +08:00
af49d6f1c2
Based on https://github.com/Homebrew/homebrew/blob/master/Library/Homebrew/cmd/update.rb#L175-L221
17 lines
389 B
Fish
17 lines
389 B
Fish
function omf.update
|
|
set -l repo "upstream"
|
|
test -z (git config --get remote.upstream.url)
|
|
and set -l repo "origin"
|
|
|
|
if git diff-index --quiet HEAD -- >/dev/null ^&1
|
|
git pull $repo master >/dev/null ^&1
|
|
else
|
|
git stash >/dev/null ^&1
|
|
if git pull --rebase $repo master >/dev/null ^&1
|
|
git stash apply >/dev/null ^&1
|
|
else
|
|
omf.repo.sync
|
|
end
|
|
end
|
|
end
|