Skip to content

Instantly share code, notes, and snippets.

@sainu
Created May 8, 2016 14:55
Show Gist options
  • Save sainu/c4642bb8a01ef08140531cc4fd5ad6a1 to your computer and use it in GitHub Desktop.
Save sainu/c4642bb8a01ef08140531cc4fd5ad6a1 to your computer and use it in GitHub Desktop.

ブランチを作成する

git branch branch_name

ブランチを作成して、チェックアウトもする

git checkout -b branch_name

ブランチを削除する

git branch -d [branchname]

ブランチを切り替える

git checkout branch_name

ファイル状況を確認する

git status

ファイル単位でインデックスに追加する

git add file_path file_path file_path

全変更ファイルをインデックスに追加する

git add .

詳細メッセージ込みのコミットする

git commit

タイトルのみでコミット�する

git commit -m 'message'

コミットを取り消す(ログを残す)

git revert [commit_number]

直前のコミットを取り消す(ログを残さない)

git reset --hard HEAD^

プッシュする

git push [reponame] [branchname]:[branch]

プルする

git pull [reponame] [branch]

インデックスにあげたファイルを戻す

git reset HEAD file_path

ブランチ一覧を見る

git branch

リモートブランチ込みでブランチ一覧を見る

git branch -a

コミットログを見る

git log

マージ状況もわかるログを見る

git log --graph

リモートリポジトリを追加する

git remote add origin [url]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment