この文書の現在のバージョンと選択したバージョンの差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
|
git:コマンド [2019/09/19 11:05] ips |
git:コマンド [2020/09/21 18:42] (現在) ips |
||
|---|---|---|---|
| ライン 5: | ライン 5: | ||
| <code> | <code> | ||
| > git init | > git init | ||
| + | </code> | ||
| + | |||
| + | ===== コミットする ===== | ||
| + | |||
| + | <code> | ||
| + | git commit -m "ファーストコミット" | ||
| + | </code> | ||
| + | |||
| + | ===== コミットメッセージの修正 ===== | ||
| + | |||
| + | <code> | ||
| + | >git commit --amend | ||
| </code> | </code> | ||
| ライン 140: | ライン 152: | ||
| <code> | <code> | ||
| $ git cat-file -p [commitID]:[ファイル名] | $ git cat-file -p [commitID]:[ファイル名] | ||
| + | </code> | ||
| + | |||
| + | ===== originの設定 ===== | ||
| + | <code> | ||
| + | # originの設定 | ||
| + | >git remote add origin https://github.com/nekotype/xxxxx.git | ||
| + | |||
| + | # push | ||
| + | >git push -u origin master | ||
| + | |||
| + | # fatal: remote origin already exists.とでてoriginを設定できないときは一旦削除して再登録。 | ||
| + | >git remote rm origin | ||
| + | |||
| + | </code> | ||
| + | |||
| + | ===== 削除したファイルを復元する ===== | ||
| + | |||
| + | <code> | ||
| + | # ファイル名を確認する。(まだコミットしていない場合) | ||
| + | > git diff HEAD --name-only | ||
| + | |||
| + | # ファイル名を確認する。(特定のコミットにあるファイルの場合はgit logでコミットIDを確認してから) | ||
| + | > git diff HEAD <コミットID> --name-only | ||
| + | |||
| + | # 復元する。git checkout <commit> -- <FILE_PATH> | ||
| + | > git checkout HEAD -- app/src/main/res/drawable/radius.xml | ||
| + | |||
| + | </code> | ||
| + | |||
| + | ===== 現在のブランチを確認する ===== | ||
| + | <code> | ||
| + | >git branch | ||
| + | * feature/xxxxxx //←カレントに*がついている | ||
| + | master | ||
| + | </code> | ||
| + | |||
| + | ===== ステージングの内容確認 ===== | ||
| + | <code> | ||
| + | >git status | ||
| + | On branch feature/prac_css_flex | ||
| + | Changes to be committed: | ||
| + | (use "git reset HEAD <file>..." to unstage) | ||
| + | |||
| + | modified: index.html | ||
| + | modified: main.js | ||
| + | modified: main.ts | ||
| + | modified: style.css | ||
| + | new file: tsconfig.json | ||
| + | </code> | ||
| + | |||
| + | ===== ツリー表示させる ===== | ||
| + | [[https://git-scm.com/book/ja/v2/Appendix-A%3A-%E3%81%9D%E3%81%AE%E4%BB%96%E3%81%AE%E7%92%B0%E5%A2%83%E3%81%A7%E3%81%AEGit-%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%82%AB%E3%83%AB%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9|A1.1 Appendix A: その他の環境でのGit - グラフィカルインタフェース]] | ||
| + | <code> | ||
| + | gitk | ||
| + | gitk --all | ||
| </code> | </code> | ||