0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[Git] 動作を試す 実行例41:--bareでローカルリポジトリからリモートリポジトリを作成

Posted at

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等は不使用。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?