This is a fork of https://gist.github.com/lttlrck/9628955 to make the renaming of branches simpler.
- Ensure the script is executable.
git-rename.sh [oldbranchname] newbranchname [upstreamname]
[anything]
- denotes an optional positional argumentgit-rename.sh
- is the name of this script
If your target new name is your current branch name. This won't work
This does not force push. If you have a remote branch, this should not be able to push, even if your local is out of sync. Please avoid modifying to force push. That can be dangerous.
It specifies a shell, which I'm not ecstatic about, but seemed necesarry for the shellcheck to stop erroring. I guess it removes ambiguity. If this becomes a problem, please feel free to change to bourne again or zsh. Other shell interpreters are expected not to work.
If you have bash or zsh installed, you can call the script using bash git-rename.sh [args]
or zsh git-rename.sh [args]
Verified using https://www.shellcheck.net/