diff options
Diffstat (limited to '.config/git/config')
| -rw-r--r-- | .config/git/config | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/.config/git/config b/.config/git/config index b9f22a6..9d0d14b 100644 --- a/.config/git/config +++ b/.config/git/config @@ -192,10 +192,14 @@ fi; \ }; __fn" sync-upstream = "!__fn() { \ - local branch=\"$(git current-branch)\"; \ + if [ \"$1\" = \"\" ]; then \ + local branch=\"$(git current-branch)\"; \ + else \ + local branch=\"$1\"; \ + fi; \ if git rev-parse --verify --quiet \"origin/$branch\" > /dev/null 2>&1 && \ git rev-parse --verify --quiet \"upstream/$branch\" > /dev/null 2>&1; then \ - git reset --hard \"upstream/$branch\" && \ + git branch --force \"$branch\" \"upstream/$branch\" && \ git push --force-with-lease origin \"$branch\"; \ else \ echo \"error: branch '$branch' not found on both origin and upstream\" >&2; \ |
