Ada 2 perintah yang bisa digunakan untuk untuk mengganti nama branch:

1
2
git branch -m blog-posts # « jika sedang berada di branch yang akan diganti nama
git branch -m blog-source blog-posts # « jika sedang berada di branch lain

Hapus remote branch-lama:
1
2
3
$ git push origin -d blog-source
To github.com:go2n/go2n.github.io.git
- [deleted] blog-source

Push remote branch-baru:

1
2
3
4
5
6
7
8
9
$ git push origin blog-posts 
Counting objects: 127, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (110/110), done.
Writing objects: 100% (127/127), 3.67 MiB | 732.00 KiB/s, done.
Total 127 (delta 26), reused 32 (delta 0)
remote: Resolving deltas: 100% (26/26), done.
To github.com:go2n/go2n.github.io.git
* [new branch] blog-posts -> blog-posts

Atur upstream untuk branch baru:

1
2
3
$ git push -u origin blog-posts 
Branch 'blog-posts' set up to track remote branch 'blog-posts' from 'origin'.
Everything up-to-date

Rujukan: manpage git-branch