From 004316ce2e007f423e0615825de05783fb9a0dd4 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 16 Jul 2012 18:38:32 +0200 Subject: bashrc/main: no need for reset anymore --- bashrc/main.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'bashrc') 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 -- cgit v1.2.3