dotfiles
20 строк · 550.0 Байт
1#!/bin/bash
2
3# Rename the local branch to the new name
4git branch -m $1 $2
5
6# Delete the old branch on remote - where <remote> is, for example, origin
7git push origin --delete $1
8
9# Or shorter way to delete remote branch [:]
10git push origin :$1
11
12# Prevent git from using the old name when pushing in the next step.
13# Otherwise, git will use the old upstream name instead of <new_name>.
14git branch --unset-upstream $2
15
16# Push the new branch to remote
17git push origin $1
18
19# Reset the upstream branch for the new_name local branch
20git push origin -u $1
21