IT系/リファレンス/Gitコマンド/git_bundle

Last-modified: 2020-06-01 (月) 00:20:34

git bundle

アーカイブによるオブジェクトと参照の移動を行うコマンド。
直接通信できないリポジトリと同期をとるためのバンドルファイルを作成する。

用例

  • masterのバンドルファイルを作成
    git bundle create bundle_file master
  • バンドルファイル「bundle_file」が妥当かの検証を行う
    git verify bundle_file
  • バンドルファイル「bundle_file」で定義されているコミットの情報などを表示
    git bundle list-heads <bundle_file>

書式

git bundle create|verify|list-heads|unbundle [options] <file>

公式によると以下の通り。

git bundle create [-q | --quiet | --progress | --all-progress] [--all-progress-implied] <file> <git-rev-list-args>
git bundle verify [-q | --quiet] <file>
git bundle list-heads <file> [<refname>…]
git bundle unbundle <file> [<refname>…]

options

create [options] <file> <git-rev-list-args>Used to create a bundle named file. This requires the <git-rev-list-args> arguments to define the bundle contents. options contains the options specific to the git bundle create subcommand.
verify <file>Used to check that a bundle file is valid and will apply cleanly to the current repository. This includes checks on the bundle format itself as well as checking that the prerequisite commits exist and are fully linked in the current repository. git bundle prints a list of missing commits, if any, and exits with a non-zero status.
list-heads <file>Lists the references defined in the bundle. If followed by a list of references, only references matching those given are printed out.
unbundle <file>Passes the objects in the bundle to git index-pack for storage in the repository, then prints the names of all defined references. If a list of references is given, only references matching those in the list are printed. This command is really plumbing, intended to be called only by git fetch.
<git-rev-list-args>A list of arguments, acceptable to git rev-parse and git rev-list (and containing a named ref, see SPECIFYING REFERENCES below), that specifies the specific objects and references to transport. For example, master~10..master causes the current master reference to be packaged along with all objects added since its 10th ancestor commit. There is no explicit limit to the number of references and objects that may be packaged.
[<refname>…​]A list of references used to limit the references reported as available. This is principally of use to git fetch, which expects to receive only those references asked for and not necessarily everything in the pack (in this case, git bundle acts like git fetch-pack).
--progressProgress status is reported on the standard error stream by default when it is attached to a terminal, unless -q is specified. This flag forces progress status even if the standard error stream is not directed to a terminal.
--all-progressWhen --stdout is specified then progress report is displayed during the object count and compression phases but inhibited during the write-out phase. The reason is that in some cases the output stream is directly linked to another command which may wish to display progress status of its own as it processes incoming pack data. This flag is like --progress except that it forces progress report for the write-out phase as well even if --stdout is used.
--all-progress-impliedThis is used to imply --all-progress whenever progress display is activated. Unlike --all-progress this flag doesn’t actually force any progress display by itself.
-q | --quietThis flag makes the command not to report its progress on the standard error stream.

説明

アーカイブによるオブジェクトと参照の移動を行うコマンド。直接通信できないリポジトリと同期をとるためのバンドルファイルを作成する。

  • gitで管理しているファイルを、クローズドな環境の別のマシンに移動する、といったケースに使用できる。
  • バックアップとしても利用可能。

関連

  • なし

参考リンク

その他メモ

なし。