This Bash script allows you to easily rename both local and remote branches in a Git repository.
- Git must be installed on your system.
-
Clone this repository to your local machine and navigate to the directory.
git clone https://github.com/aaronpo97/git-rename cd git-rename
-
Run the following command to make the script executable:
chmod +x rename-branch.sh
-
Go to the directory containing the Git repository you want to rename a branch in.
cd /path/to/repository
-
Run the script.
location/of/git-rename/rename-branch.sh
-
Follow the prompts to rename a Git branch.
$ ./rename-branch.sh
Would you like to rename a branch? (y/n) y
Enter the old branch name: feature/old-feature
Enter the new branch name: feature/new-feature
Branch 'feature/old-feature' has been successfully renamed to 'feature/new-feature'.
This script is licensed under the MIT License. See the LICENSE file for details.
Aaron Po