Last active
December 12, 2015 03:18
-
-
Save irasally/4705224 to your computer and use it in GitHub Desktop.
git basic commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
== 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