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?

Git bundleを使ってリポジトリをオフラインで共有する

0
Posted at

1. はじめに

  • Git bundleを使ってリポジトリをファイルで共有して一部オフラインで開発を行いたい

2. 開発環境

  • Git version 2.37.0
  • Windows 11

3. バンドルファイルの作成

  • リポジトリのルートディレクトリで以下のコマンドを実行する
# 全てのブランチを含むバンドルを作成する場合
git bundle create myproject.bundle --all
# ブランチ単位でバンドルを作成する場合 (例)masterブランチ
git bundle create myproject.bundle master
  • 実行結果
    image.png
    image.png

4. バンドルファイルの検証

  • バンドルファイルが正しく作成されたかを確認するには、以下のコマンドを実行する
git bundle verify myproject.bundle
  • 実行結果
    image.png

5. バンドルファイルからのクローン

  • バンドルファイルから新しいリポジトリを作成するには以下のコマンドを実行する
  • クローン直後はワーキングツリーが空の状態になっているため、以降でワーキングツリーを復元する
git clone myproject.bundle myproject
  • クローンしたリポジトリに移動するため以下のコマンドを実行する
cd myproject
  • バンドルファイルから復元するために以下のコマンドを実行する
# バンドルファイルから復元するブランチを指定する(例:masterブランチ)
git reset --hard origin/master
  • 実行結果
    image.png
    image.png

6. 参考文献




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?