LoginSignup
10
11

More than 5 years have passed since last update.

gitコマンド備忘録

Last updated at Posted at 2015-11-17

個人的によく使うgitコマンドを随時メモとして追加していきます

gitでoriginのurlを確認したい

$ config --get remote.origin.url

# こっちのコマンドだと、fetch・pushの両方みれる
$ git remote -v

gitレポの情報をみたい

$ git config -l

ブランチ周りで使うコマンド

# ブランチの作成
$ git branch {branch_name}

# 今いるブランチを確認する
$ git branch 

# ブランチの向き先を変更する
$ git checkout {branch_name}

コミットする時に使うコマンド

# 変更のあるファイルを確認
$ git status

# 変更したファイルをaddする
$ git add {file_path}

# 変更したファイルを指定してcommitする
$ git commit  {file_path} -m "commit message"

# 変更したファイルを一括でcommitする
$ git commit  {file_path} -am "commit message"

# うっかりコミットメッセージ間違えた時に変更する
$ git commit --amend -m "new commit message"

# コミットメッセージが変更されたことを確認する
$ git log

# 変更したbranchをoriginへpushする
$ git push origin {branch_name}
10
11
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
10
11