LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

git-rename-branch

Rename a Git branch locally and on the remote

TLDR

Rename current branch
$ git rename-branch [new_name]
copy
Rename specific branch
$ git rename-branch [old_name] [new_name]
copy

SYNOPSIS

git rename-branch [oldname] newname

DESCRIPTION

git rename-branch renames a branch both locally and on the remote. Part of git-extras, it handles the local rename, pushes the new branch name to the remote, deletes the old remote branch, and updates the upstream tracking reference in a single command.Without this tool, renaming a remote branch requires multiple steps: `git branch -m`, `git push origin newname`, `git push origin --delete oldname`, and `git branch -u origin/new_name`.

PARAMETERS

old_name

The current name of the branch to rename. If omitted, the current branch is used.
new_name
The new name for the branch.

INSTALL

sudo apt install git
copy
sudo dnf install git
copy
sudo pacman -S git
copy
sudo apk add git
copy
sudo zypper install git
copy
brew install git
copy
nix profile install nixpkgs#git
copy

CAVEATS

Requires git-extras to be installed. Other collaborators must update their local references after the rename. Pull requests or merge requests targeting the old branch name may need manual updates.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid