diff options
-rw-r--r-- | bashrc/main.sh | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/bashrc/main.sh b/bashrc/main.sh index b02c29d..e5ba2d6 100644 --- a/bashrc/main.sh +++ b/bashrc/main.sh @@ -46,9 +46,8 @@ _self_update() { if [[ $_merge != 'n' ]]; then _local_changes="$(git status | grep '^# Change')" _old_origin="$(git rev-list -n1 old-origin)" - _old_head="$(git rev-list -n1 HEAD)" - if [[ "$_old_origin" != "$_old_head" ]]; then + if [[ "$_old_origin" != "$(git rev-list -n1 HEAD)" ]]; then echo -e "\033[31m*\033[0m You have some local commits. I will now try to rebase them" echo " onto the new origin/master." fi @@ -59,16 +58,12 @@ _self_update() { git stash >/dev/null || return fi - git reset --hard origin/master >/dev/null - # update old-origin git tag -d old-origin >/dev/null 2>&1 - git tag old-origin origin-master >/dev/null 2>&1 + git tag old-origin origin/master >/dev/null 2>&1 - if [[ "$_old_origin" != "$_old_head" ]]; then - echo -e "\033[33m*\033[0m git rebase --onto HEAD $_old_origin $_old_head" - git rebase --onto origin/master $_old_origin $_old_head || return - fi + echo -e "\033[33m*\033[0m git rebase --onto origin/master $_old_origin" + git rebase --onto origin/master $_old_origin || return if [[ -n "$_local_changes" ]]; then git stash pop >/dev/null || return |