Last active
March 16, 2017 04:41
-
-
Save shoheiyokoyama/f778b860b8c3bbb2456946586d51b968 to your computer and use it in GitHub Desktop.
Gitコマンド「虎の巻」 ref: http://qiita.com/shoheiyokoyama/items/58a61f6029587e952842
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
| $ git commit -am"commit message"` |
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
| commit 2807055f737ee79962a7373996165598478704a3 | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Tue Oct 11 09:44:08 2016 +0900 | |
| fixed file1.text | |
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
| $ git add . | |
| $ git commit --amend -m"commit mesage" |
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
| commit d9d1012289748c614787399ec3d1b8e98172c156 | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Tue Oct 11 07:15:52 2016 +0900 | |
| fixed2 sample-file | |
| commit 5de2cd2918e148a9317fc9192cfb635fd878fa49 | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Tue Oct 11 07:15:30 2016 +0900 | |
| fixed sample-file | |
| commit 63b89bece5a508c418f7c3a0c00a15f1a4b04ec1 | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Tue Oct 11 07:14:50 2016 +0900 | |
| create sample-file |
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
| pick 5de2cd2 fixed sample-file | |
| pick d9d1012 fixed2 sample-file | |
| ... |
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
| # sでもOK | |
| pick 5de2cd2 fixed sample-file | |
| s d9d1012 fixed2 sample-file | |
| ... |
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
| # This is a combination of 2 commits. | |
| # The first commit's message is: | |
| fixed sample-file | |
| # The is the 2nd commit's message: | |
| fixed2 sample-file | |
| ... | |
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
| commit 422219b91022e006dc87766aab2e43cb4d670e89 | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Tue Oct 11 07:26:34 2016 +0900 | |
| fixed sample-file | |
| fixed2 sample-file | |
| commit 63b89bece5a508c418f7c3a0c00a15f1a4b04ec1 | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Tue Oct 11 07:14:50 2016 +0900 | |
| create sample-file | |
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
| $ git reset --soft HEAD^ |
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
| $ git reset --hard HEAD^ |
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
| $ git reset --hard HEAD~x |
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
| $ git reset --hard HEAD |
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
| Your branch is ahead of 'origin/master' by 1 commit. | |
| (use "git push" to publish your local commits) | |
| Changes not staged for commit: | |
| (use "git add <file>..." to update what will be committed) | |
| (use "git checkout -- <file>..." to discard changes in working directory) | |
| modified: firstFile.text | |
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
| $ git reset HEAD filename |
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
| $ git branch | |
| * branch1 | |
| master |
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
| $ git log | |
| commit 4ae31b629d788a576edd02426dabcb3a69ab62b2 | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Tue Nov 1 14:44:13 2016 +0900 | |
| commit2 | |
| commit d727ad50a8c673aacc727af6b9571697d99048db | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Tue Nov 1 14:43:46 2016 +0900 | |
| commit1 |
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
| $ git checkout master | |
| Switched to branch 'master' | |
| $ git cherry-pick d727ad5 |
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
| $ git cherry-pick d727ad5 -n |
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
| $ git cherry-pick branch1~2..branch1 |
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
| $ git stash |
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
| $ git stash pop |
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
| $ git stash save "stash message" |
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
| $ git stash list | |
| stash@{0}: On master: stash message2 | |
| stash@{1}: On master: stash message |
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
| commit a12388f3d3548ac713fe52b0da87279260055fff | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Tue Oct 11 09:44:08 2016 +0900 | |
| fixed file1.text | |
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
| $ git stash pop stash@{1} |
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
| $ git stash apply pop stash@{1} |
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
| $ git stash drop stash@{1} |
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
| $ git stash clear |
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
| $ git checkout -b tagname refs/tags/tagname |
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
| commit 121a4d7729700d363e56b681e27518bf4ac0f34b | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Fri Sep 30 11:10:56 2016 +0900 | |
| third commit | |
| commit 3fbea2f615acf7878d76f94594932633d5e39e17 | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Fri Sep 30 11:07:13 2016 +0900 | |
| second commit | |
| commit 404a1c9c88824e0921e3795a49a7c5e2ce7c27f7 | |
| Author: shoheiyokoyama <[email protected]> | |
| Date: Fri Sep 30 11:06:47 2016 +0900 | |
| first commit |
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
| pick 3fbea2f second commit | |
| pick 121a4d7 third commit | |
| ... |
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
| # eでもOK | |
| edit 3fbea2f second commit | |
| pick 121a4d7 third commit | |
| ... |
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
| Stopped at 3fbea2f615acf7878d76f94594932633d5e39e17... second commit | |
| You can amend the commit now, with | |
| git commit --amend | |
| Once you are satisfied with your changes, run | |
| git rebase --continue |
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
| $ git add . | |
| $ git commit --amend |
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
| second commit | |
| # Please enter commit message for your cahnges. Lines starting | |
| # with '#' ignored, and an empty message aborts the commit | |
| # | |
| # Date: ... | |
| # | |
| # ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment