久しぶりにgit系ブログになります。
なぜか以下のブログアクセス数がぱないので、(有り難し!)
branch系の使い方(第一弾!)をブログします。
今回はbranch切った時にbranch名ダサいから変更したい場合、
どうすんのてな感じです。
■branch[go→adachin-develop]に変更する
※エイリアス設定してるためgitコマンドが省略されています(白目)
同じように変更したい場合は以下のようにするといい感じ。
| 1 2 3 4 5 6 7 8 9 10 | $ more ~/.gitconfig [alias]  g = git  st = status  ss = status -s  sh = show  ch = checkout  br = branch  co = commit  pu = push | 
・現在のローカルbranchとリモートbranch
なんでgoにしたんだろw
git branch -aでローカルとリモートのbranchが確認できます。
| 1 2 3 4 5 6 | Adachin-mini > g br -a * go  master  remotes/origin/HEAD -> origin/master  remotes/origin/go  remotes/origin/master | 
・branch名goをadachin-developに
ローカルのbranch名が変わった。
次はリモートも変更する。
| 1 2 3 4 5 6 7 | Adachin-mini > g br -m go adachin-develop Adachin-mini > g br -a * adachin-develop  master  remotes/origin/HEAD -> origin/master  remotes/origin/go  remotes/origin/master | 
・リモートのbranch名goを抹消する
| 1 2 3 | Adachin-mini > g pu origin :go To github.com:RVIRUS0817/adachin_git.git  - [deleted] go' →抹消 | 
・確認
なくなった
| 1 2 3 4 5 | Adachin-mini > g br -a * adachin-develop  master  remotes/origin/HEAD -> origin/master  remotes/origin/master | 
・リモートにadachin-developをpushする
| 1 2 3 4 5 6 7 8 9 10 | Adachin-mini > g pu -u origin adachin-develop  Counting objects: 15, done.  Delta compression using up to 8 threads.  Compressing objects: 100% (12/12), done.  Writing objects: 100% (15/15), 2.18 KiB | 0 bytes/s, done.  Total 15 (delta 6), reused 0 (delta 0)  remote: Resolving deltas: 100% (6/6), completed with 3 local objects.  To github.com:RVIRUS0817/adachin_git.git  * [new branch] adachin-develop -> adachin-develop →追加された  Branch adachin-develop set up to track remote branch adachin-develop from origin. | 
・確認
ローカルとリモートにpushされてOK!
| 1 2 3 4 5 6 | Adachin-mini > g br -a  * adachin-develop  master  remotes/origin/HEAD -> origin/master  remotes/origin/adachin-develop →追加された  remotes/origin/master | 
■まとめ
今まで個人的にやってるgithubへはmasterにpushしてたので、
branch切ってやろう。
ぼっちレビューで悲しいけど(泣)
 
													 
													 
													
0件のコメント