ブランチ操作
ブランチ切替
- git checkout hoge
カレントから新しいブランチの作成
- git branch -b hoge/fugafuga
作ったブランチをremote にpush
- git push origin hoge/fugafuga
リモートブランチ一覧
- git branch -r
リモートブランチとってくる
- git checkout feat/hogehoge
リモートブランチの削除
- git branch -r -d hoge/fugafuga
カレントのブランチ名の変更
- git branch -m 変更後の名前
既に削除したリモートブランチを一覧から削除
- git fetch --prune
ブランチがどこから分岐してんのか見る(masterから分岐した例)
特定ブランチのclose
- git clone -b ブランチ名 リポジトリアドレス(http…)
コミットを書き換える
チェリーピック
- git cherry-pick #hash#
コンフリクトしたら、解消して、git add & git commit
強制PUSH
- git push -f -n #repository# #local_branch# : #remote_branch#
- -nはdry-run
マージをrevert
- git revert -m 1 mergeしたコミットのhash
- 参考:http://box406.hatenablog.com/entry/2014/04/23/215805
commitまとめる
authorかえる
リポジトリ操作
認証
- httpsで毎回パスワード聞かれる問題への対応
TIPS
- git pull = fetch + merge origin/master
- -dと-Dの違い
- masterにmerge済のものを消す時は-d
- mergeしてないものを含む問答無用で消すのが-D
- gitでaddする前の状態で別ブランチに移動したくなった時に変更内容を避けておく方法。 - Qiita
GitHub実践入門 ~Pull Requestによる開発の変革 (WEB+DB PRESS plus)
- 作者: 大塚弘記
- 出版社/メーカー: 技術評論社
- 発売日: 2014/03/20
- メディア: 単行本(ソフトカバー)
- この商品を含むブログ (23件) を見る