Gitの動作を理解するために、Gitのコマンドを実際に試して、結果を見てみました。
1つの記事内で一連のGitコマンドが完結しているので、これら一連のコマンドを順に実行させて結果を見ることで、一連のGitの動作を実際に体感でき、一通り独習することが可能です。
※前回記事のリポジトリ状態からの続きになっています。
前回記事へ | 目次へ:Git関連記事のまとめページ | 次回記事へ |
---|
実行例
cd /test-space
※通常の作業用リポジトリをクローンして、そのまま新たにベアリポジトリを作成する(共有専用のリポジトリ)
git clone --bare D:/test-space/local-repo2 remote-repo2.git
↓
結果:
Cloning into bare repository 'remote-repo2.git'...
done.
dir /b
↓
結果:
local-repo1
local-repo2
remote-repo1.git
remote-repo2.git
cd /test-space/remote-repo2.git
git log --oneline --graph --all
↓
結果:
* e009b2d (branch-R1) message R2
| * c69a305 (HEAD -> master) message R1
| * 94996a0 message4
|/
* 20bbab7 message3
* 00cad71 message2
* 4ace194 message1
cd /test-space/local-repo2
git remote -v
↓
結果:
origin D:/test-space/remote-repo1.git (fetch)
origin D:/test-space/remote-repo1.git (push)
(※クローン元のリポジトリでは接続の追加はされない)
-----
※remote-repo2.gitを削除
cd /test-space
rd /s /q "/test-space/remote-repo2.git"
環境
Windows 10、PortableGit-2.40.0-64-bitを使用、全てローカルPC上で実施、GitHub等は不使用。