Git Rename Script
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 argument
git-rename.sh- is the name of this script
Using on the current active branch name
If your target new name is your current branch name. This won't work
Pushing to a branch that exists remotely
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.
The script does not work
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]