Tsallaka zuwa abun ciki
Justice Tech School

Deleting Remote Branches

Push with --delete removes a branch on the remote.

Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
git init -q --bare ../r.git && git remote add origin ../r.git && git push -q -u origin main
git push -q origin main:old
git push -q origin --delete old
git ls-remote --heads origin | wc -l

Result

1

Exercise

Remove remote branch.

git push origin  old

Quiz Test

What does main:old do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.