Skip to content

Instantly share code, notes, and snippets.

@taogawa
Last active March 21, 2016 03:11
Show Gist options
  • Save taogawa/7d86fb0fd9e9da1ef71f to your computer and use it in GitHub Desktop.
Save taogawa/7d86fb0fd9e9da1ef71f to your computer and use it in GitHub Desktop.
Gitでよく使うコマンド

リモートリポジトリからブランチをチェックアウトする

developをリモートからチェックアウトする場合

$ git checkout -b develop origin/develop

リモートリポジトリの更新を取り込む

$ git checkout branch_name
$ git fetch
# 現在のブランチ名と同じ名前のリモートブランチとマージする
$ git merge origin/branch_name

リモートリポジトリへブランチをpushする

$ git push origin branch_name

ブランチ名の修正

$ git branch -m old_branch_name new_branch_name

コミットメッセージの行頭にハッシュ(#)を付ける

#9999 commit message のようにissue番号をコミットメッセージの頭に付けたい場合など

$ git commit --cleanup=whitespace

1行のコミットメッセージであれば、以下でOK

$ git commit -m '#9999 commit message'

マージコミットをつくらずマージする

$ git merge branch_name --no-commit

マージをやめて元に戻す場合

$ git merge --abort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment