$ git clone git://git.savannah.nongnu.org/weechat.git Cloning into 'weechat'... remote: Counting objects: 73778, done. remote: Compressing objects: 100% (12068/12068), done. remote: Total 73778 (delta 62167), reused 73125 (delta 61675) Receiving objects: 100% (73778/73778), 29.39 MiB | 1.75 MiB/s, done. Resolving deltas: 100% (62167/62167), done. $ cd weechat/ $ git config user.name "AYANOKOUZI, Ryuunosuke" && git config user.email "i38w7i3@yahoo.co.jp" $ git remote add github git@github.com:l/WeeChat.git $ git remote -v github git@github.com:l/WeeChat.git (fetch) github git@github.com:l/WeeChat.git (push) origin git://git.savannah.nongnu.org/weechat.git (fetch) origin git://git.savannah.nongnu.org/weechat.git (push) $ git branch translation origin/HEAD Branch translation set up to track remote branch master from origin. $ git checkout translation Switched to branch 'translation' $ git branch -a -v master 70ffe0a core: add completion "plugins_installed" * translation 70ffe0a core: add completion "plugins_installed" remotes/origin/0.3.1 4c34d00 Version 0.3.1.1 remotes/origin/0.3.9 2429c9d Version 0.3.9.2 remotes/origin/HEAD -> origin/master remotes/origin/branch-0-2-6 d486a02 Version 0.2.6.3 remotes/origin/buffer-auto-renumber c82633e core: use first gap for new buffer only if the buffer has no layout number remotes/origin/master 70ffe0a core: add completion "plugins_installed"
リモート(github)にローカルブランチ(translation)をpushする
$ git push github translation Enter passphrase for key '********************': Counting objects: 78, done. Delta compression using up to 2 threads. Compressing objects: 100% (45/45), done. Writing objects: 100% (45/45), 16.92 KiB, done. Total 45 (delta 27), reused 0 (delta 0) To git@github.com:l/WeeChat.git * [new branch] translation -> translation
githubのりポジトリsettingページでdefault branchをmasterからtranslationにする。これはgithubの制限。githubではdefalutbranchになっているものを削除リモートからブランチ(master)を削除するために必要。これを行う前にgithubからmasterブランチを削除すると以下のようなエラーが返される。
$ git push github :master Enter passphrase for key '********************': remote: error: refusing to delete the current branch: refs/heads/master To git@github.com:l/WeeChat.git ! [remote rejected] master (deletion of the current branch prohibited) error: failed to push some refs to 'git@github.com:l/WeeChat.git'
リモートブランチ(master)を削除し、新たなmasterブランチをリモートにpushする。
$ git push github :master Enter passphrase for key '********************': To git@github.com:l/WeeChat.git - [deleted] master $ git push github master Enter passphrase for key '********************': Total 0 (delta 0), reused 0 (delta 0) To git@github.com:l/WeeChat.git * [new branch] master -> master
github上のsettingsページでDefault Branchをmasterに戻す。この後にtranslationブランチを削除。
$ git push github :translation Enter passphrase for key '********************': To git@github.com:l/WeeChat.git - [deleted] translation