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