Last active
July 19, 2017 10:12
-
-
Save aq2bq/5925009 to your computer and use it in GitHub Desktop.
StudyingGit:復習メモ
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ブランチをローカルにチェックアウトする | |
| $ git checkout -b branch_name origin/branch_name | |
| ## - http://sessan.hatenablog.com/entry/2012/11/04/132746 | |
| ## masterブランチに加えられた変更をトピックブランチへマージする | |
| $ git checkout topic_branch | |
| $ git merge master | |
| ## - http://d.hatena.ne.jp/inouetakuya/20130602/1370173582 | |
| ## リモートのタグをチェックアウトする | |
| $ git checkout -b 1.6 refs/tags/v1.6 | |
| ## - http://d.hatena.ne.jp/kanonji/20110304/1299211488 | |
| # - - - | |
| # やり直し系 | |
| ## addする前に戻す | |
| $ git rm --cached . | |
| ## addしたファイルを取り消す(更新内容は維持される) | |
| $ git reset HEAD file_name | |
| ## addしたファイルを取り消す(更新内容もろとも取り消す) | |
| $ git checkout file_name | |
| ## ソフトリセット:コミットを取り消す(更新内容は維持される) | |
| $ git reset --soft HEAD^ | |
| $ git reset --soft commit_id | |
| ## ハードリセット:コミットを取り消す(更新内容もろとも取り消す) | |
| $ git reset --hard HEAD^ | |
| $ git reset --hard commit_id | |
| ## ハードリセットしたコミットを復旧する | |
| $ git reflog | |
| ### => ... HEAD@{n}: ... | |
| $ git reset --hard HEAD@{n} | |
| ## コミットメッセージを直す | |
| $ git commit --amend | |
| ## - http://tech.basicinc.jp/Git/2013/06/15/git_command/ | |
| ## - http://www.slideshare.net/TomohikoHimura/git-22237343 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment