LoginSignup
17
14

More than 5 years have passed since last update.

[初心者向け]git幼稚園児がgit小学生になるまでに覚えたコマンド(順次更新)

Last updated at Posted at 2016-11-12

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名)

17
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
14