You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Rename remote branch (and possibly Rename tag as well) #1457
If there's a local branch <tracker> that's tracking <remote>/<old_name>, we should change its upstream info to <remote>/<new_name> and probably also rename the local branch (if it still matches <old_name>) :
git branch -u <remote>/<new_name> <tracker>
git branch -m <tracker==old_name> <new_name>
NOTE: A similar feature could be added (and would be very useful) for renaming tags as well. However, more care is needed for these:
Tags are not explicitly distinguished between local and remote.
Similar to the Delete <tag> dialog, there could be a checkbox "Rename on remote repositories".
When creating a new (renamed) copy of a Annotated tag, we must make sure it retains its Tag-message, GPG signing etc.
Hmm... Sure, we can do a lot of things via Custom Actions, and the new action-input feature is great!
But in this specific case, having a Rename <branch> command on remote branches would have been very consistent with the already existing command on local branches. 🤔 I still think this could be made part of the built-in functionality, instead of having every user implement their own version of it. (Renaming a remote branch is not a super uncommon thing to do, but still tricky to remember exactly how to do it via git push...)
Anyway, there is currently no way to add a Custom Action for a Tag, which would be needed if I want to implement a custom Rename tag action! Could that be added, as a new action-Scope, along with its own related variable ${TAG} containing the name of the selected Tag?
Never seen a git client provides such feature. Deleting remote branch is a very dangerous action. It should not be combined with other operations.
I see your point, but it's not much worse (or more dangerous) than force-pushing a branch. Deletion of the original branch should only be done after verifying that the new (renamed) branch was successfully pushed and is identical.
Watch the short video in the "Tip - Renaming Branches in Tower" box on the linked page! 😉
"In case you are using the Tower Git client, you can rename both local and remote branches simply from the contextual menu (no need to delete and re-push anything)."
Tip for a Custom Action - if a remote branch is on GitHub, the following GitHub CLI (API) command can be used to rename it (needs to be called from within a local clone) :
gh api repos/{owner}/{repo}/branches/<old_name>/rename -F new_name=<new_name>
This one-liner is much simpler to setup in a Custom Action, compared to using a Git Bash script (or similar) to perform the remote renaming using git push, but it will only work for GitHub and only if GH authentication etc via CLI is already setup.
Activity
love-linger commentedon Jun 25, 2025
I've pushed a new commit that allows to use input controls (TextBox, PathSelector or CheckBox) in custom actions.
You can do this via custom action.
goran-w commentedon Jun 25, 2025
Hmm... Sure, we can do a lot of things via Custom Actions, and the new action-input feature is great!
But in this specific case, having a
Rename <branch>command on remote branches would have been very consistent with the already existing command on local branches. 🤔 I still think this could be made part of the built-in functionality, instead of having every user implement their own version of it. (Renaming a remote branch is not a super uncommon thing to do, but still tricky to remember exactly how to do it viagit push...)Anyway, there is currently no way to add a
Custom Actionfor aTag, which would be needed if I want to implement a customRename tagaction! Could that be added, as a new action-Scope, along with its own related variable${TAG}containing the name of the selected Tag?love-linger commentedon Jun 25, 2025
Never seen a git client provides such feature. Deleting remote branch is a very dangerous action. It should not be combined with other operations.
goran-w commentedon Jun 25, 2025
I see your point, but it's not much worse (or more dangerous) than force-pushing a branch. Deletion of the original branch should only be done after verifying that the new (renamed) branch was successfully pushed and is identical.
feature: add `Tag` scope for custom actions (#1457)
love-linger commentedon Jun 25, 2025
A new scope
Tagwas added.goran-w commentedon Jun 25, 2025
Thanks, that's great! I'll close this request now, to get working on Custom Actions... 😅
goran-w commentedon Jun 26, 2025
Hmm, well, this is actually (boasted as) a feature in the (commercial) Tower git-client:
https://www.git-tower.com/learn/git/faq/git-rename-branch
Watch the short video in the "Tip - Renaming Branches in Tower" box on the linked page! 😉
"In case you are using the Tower Git client, you can rename both local and remote branches simply from the contextual menu (no need to delete and re-push anything)."
goran-w commentedon Jun 30, 2025
Tip for a Custom Action - if a remote branch is on GitHub, the following GitHub CLI (API) command can be used to rename it (needs to be called from within a local clone) :
gh api repos/{owner}/{repo}/branches/<old_name>/rename -F new_name=<new_name>This one-liner is much simpler to setup in a Custom Action, compared to using a Git Bash script (or similar) to perform the remote renaming using
git push, but it will only work for GitHub and only if GH authentication etc via CLI is already setup.