|
サイズ: 1383
コメント:
|
サイズ: 1510
コメント:
|
| 削除された箇所はこのように表示されます。 | 追加された箇所はこのように表示されます。 |
| 行 15: | 行 15: |
| commitごとにmessageがつくので「1commit1機能」を心がけるとわかりやすい | |
| 行 23: | 行 24: |
| commitがたまってきたらpush | |
| 行 26: | 行 28: |
| * 変更されたファイルの一覧を確かめたい | * 変更されたファイルの一覧を確かめたい |
| 行 30: | 行 32: |
| * commit履歴を見たい | * commit履歴を見たい |
| 行 33: | 行 36: |
| * 前回のcommitをやり直したい | * 前回のcommitをやり直したい |
| 行 36: | 行 40: |
| * 前回のcommitを消し去りたい | * 前回のcommitを消し去りたい |
| 行 40: | 行 45: |
| * branchを切りたい | * branchを切りたい |
| 行 43: | 行 49: |
| * serverから他の人がpushした内容を受け取りたい | * serverから他の人がpushした内容を受け取りたい |
| 行 47: | 行 54: |
| * branchの派生元を変更したい | * branchの派生元を変更したい |
| 行 50: | 行 58: |
| * 特定のファイルの内容を前回のcommit時のものに戻したい | * 特定のファイルの内容を前回のcommit時のものに戻したい |
| 行 53: | 行 62: |
| * 前回のcommitからの変更点を確認したい | * 前回のcommitからの変更点を確認したい |
最初だけやること
git clone <gitレポジトリのURI> *repositoryに中身がが存在しない場合はmkdir cd <working directory> git init git remote add origin <gitレポジトリのURI>
開発中
git add <file>
git add <file>
...
git commit -m "commit message"
commitごとにmessageがつくので「1commit1機能」を心がけるとわかりやすい
git add <file>
...
git commit -m "commit message"
...
git push origin
commitがたまってきたらpush
こんな時は?
-
変更されたファイルの一覧を確かめたい
git status
-
commit履歴を見たい
git log
-
前回のcommitをやり直したい
git commit -m "commit message" --amend
-
前回のcommitを消し去りたい
logで前々回のcommit名を調べる git reset --soft <前々回のcommit name>
-
branchを切りたい
git checkout -b <branch name>
-
serverから他の人がpushした内容を受け取りたい
git pull origin *conflictしたときの解消法はググって
-
branchの派生元を変更したい
git rebase <new src branch name>
-
特定のファイルの内容を前回のcommit時のものに戻したい
git checkout HEAD <filename>
-
前回のcommitからの変更点を確認したい
git diff
