Pages

Thursday, May 07, 2026

To batch rename git branches in cmd.exe

Note to self:

for /f "tokens=*" %i in ('git branch --format="%(refname:short)" ^| findstr /C:"feature/"') do @echo git branch -m "%i" "old/%i"

Then remove @echo to make it "really happen".

(That adds old/ to the front of anything that starts with feature/.)