Skip to content

Instantly share code, notes, and snippets.

@irasally
Last active December 12, 2015 03:18
Show Gist options
  • Save irasally/4705224 to your computer and use it in GitHub Desktop.
Save irasally/4705224 to your computer and use it in GitHub Desktop.
git basic commands.
== basic
$ git init
$ git add .
$ git status
$ git commit
== push
$ git remote add origin [url]
$ git push -u origin master
# "git push" に "-u" あるいは "--set-upstream" を付けると、push 先のブランチをトラック (デフォルトで push や pull の対象に) するように設定されます。
== branch
$ git checkout -b [new-branch-name]
$ git [branch-name]
$ git push origin [branch-name] #remoteにbranchを追加(手元にあればそのブランチを追加、なければ新しく作る)
# change branch code.
$ git push #(master and )branch
# github で masterにmerge
== masterにpull
$ git cherckout master
$ git pull #don't forget!!
== cancel committing
$ git reset HEAD~ # コミットを取消し1つ前に戻る
== cancel staging
$ git reset HEAD [FileName]
== cancel editting
$ git checkout [FileName]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment