Skip to content

Instantly share code, notes, and snippets.

@yyoda
Last active August 4, 2020 06:30
Show Gist options
  • Select an option

  • Save yyoda/13f5b618bed1e3e48108e17376388dd9 to your computer and use it in GitHub Desktop.

Select an option

Save yyoda/13f5b618bed1e3e48108e17376388dd9 to your computer and use it in GitHub Desktop.
個人的によく使う GIT コマンドの備忘録

ステージングに登録

git add aaa bbb ccc...
git add .

ステージングから外す

git reset HEAD aaa bbb ccc...

commit

git commit -m "some message"

push

git push

show status

git status

create local branch

リモートブランチなしの場合

git checkout -b {new_branch_name}

リモートブランチありの場合

git checkout -b {new_branch_name} remote/{remote_branch}
git checkout {remote_branch}

ブランチ削除

git branch --delete {target_branch_name}

コミットしていない変更を全て消す

git checkout .

直前のコミットを無かった事にする(が、変更はそのままにしておきたい)

git reset --soft HEAD^

gitのURLを確認する

git remote -v

gitの直近のコミット履歴を1件表示する

git log --pretty=format:"%h %cd %s %ce" -1

submodule

https://qiita.com/ymdymd/items/7d4a53f329fc083e1100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment