[Git] ローカルとリモートのブランチ名を変更する

memo.

[markdown]
## ローカル

“`prettyprinted
% git branch -m add_omnigraffle-pro5 add_omnigraffle-pro5_spike
% git branch
* add_omnigraffle-pro5_spike
master
“`

> * [メモ 【git】branch名の変更](http://ratememo.blog17.fc2.com/blog-entry-1025.html)

## リモート

“`prettyprinted
% git branch –all
* add_omnigraffle-pro5_spike
master
remotes/origin/HEAD -> origin/master
remotes/origin/add_omnigraffle-pro5
remotes/origin/master
remotes/upstream/master
“`

一度削除して、push し直す。

“`prettyprinted
% git push origin :add_omnigraffle-pro5
To git@github.com:DriftwoodJP/homebrew-versions.git
– [deleted] add_omnigraffle-pro5
% git push -u origin add_omnigraffle-pro5_spike
Counting objects: 8, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 518 bytes | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
To git@github.com:DriftwoodJP/homebrew-versions.git
* [new branch] add_omnigraffle-pro5_spike -> add_omnigraffle-pro5_spike
Branch add_omnigraffle-pro5_spike set up to track remote branch add_omnigraffle-pro5_spike from origin.
“`

“`prettyprinted
% git branch –all
* add_omnigraffle-pro5_spike
master
remotes/origin/HEAD -> origin/master
remotes/origin/add_omnigraffle-pro5_spike
remotes/origin/master
remotes/upstream/master
“`

> * [Locally and Remotely Renaming a Branch in Git | Benjamin L. Haas](http://www.benjaminlhaas.com/blog/locally-and-remotely-renaming-branch-git)
> * [notes: git – rename branch (local and remote)](http://sebgoo.blogspot.jp/2012/04/git-rename-branch-local-and-remote.html)

## 補遺

`-u`, `–prune` あたりを再度調べる。

> * [git-push(1)](https://www.kernel.org/pub/software/scm/git/docs/git-push.html)
[/markdown]