2 @section Integration with Git
4 @url{https://git-scm.com/, Git} version control system already has all
5 necessary tools for store-and-forward networking.
6 @url{https://git-scm.com/docs/git-bundle, git-bundle} command is
9 Use it to create bundles containing all required blobs/trees/commits and tags:
12 $ git bundle create repo-initial.bundle master --tags --branches
13 $ git tag -f last-bundle
14 $ nncp-file repo-initial.bundle remote.node:repo-$(date % '+%Y%M%d%H%m%S').bundle
17 Do usual working with the Git: commit, add, branch, checkout, etc. When
18 you decide to queue your changes for sending, create diff-ed bundle and
22 $ git bundle create repo-$(date '+%Y%M%d%H%m%S').bundle last-bundle..master
24 $ git bundle create repo-$(date '+%Y%M%d').bundle --since=10.days master
27 Received bundle on remote machine acts like usual remote:
30 $ git clone -b master repo-XXX.bundle
33 overwrite @file{repo.bundle} file with newer bundles you retrieve and
34 fetch all required branches and commits:
37 $ git pull # assuming that origin remote points to repo.bundle
38 $ git fetch repo.bundle master:localRef
39 $ git ls-remote repo.bundle
42 Bundles are also useful when cloning huge repositories (like Linux has).
43 Git's native protocol does not support any kind of interrupted download
44 resuming, so you will start from the beginning if connection is lost.
45 Bundles, being an ordinary files, can be downloaded with native
46 HTTP/FTP/NNCP resuming capabilities. After you fetch repository via the
47 bundle, you can add an ordinary @file{git://} remote and fetch the
50 Also you can find the following exec-handler useful:
52 @verbatiminclude git-bundler.sh
54 And it allows you to request for bundles like that:
55 @code{echo some-old-commit..master | nncp-exec REMOTE bundler REPONAME}.