git add, commit, push, pull しか使えない私が成長していく覚え書きです。
localのブランチを削除
git branch -d ブランチ名
localのブランチが増えてきたので整理する時に使うコマンド。
まだmergeされていないbranchは
error: The branch 'ブランチ名' is not fully merged.
If you are sure you want to delete it, run 'git branch -D ブランチ名'.
とエラーが出る。そんな時は
git branch -D ブランチ
とすればできた。
remoteのbranchをlocalに取り込む
まず、remoteのbranchを確認。
git branch -r
git checkout -b 好きなbranch名 origin/取り込みたいremoteのbranch名
あるbranchから、別のbranchを作る
git branch 別のbranch名(作りたいbranch名) あるbranch名
master以外のbranchから、masterの変更を取り込む
git rebase master
localのbranchでmergeする。
まず、git checkoutで取り込む方(本branch)のbranchに移動。その後、取り込まれる方(サブbranch)にgit mergeを実行
git checkout (取り込む方のbranch名)
git merge (取り込まれる方のbranch名)