]> Cypherpunks.ru repositories - nncp.git/blob - doc/integration/git.texi
Add various documentation indices
[nncp.git] / doc / integration / git.texi
1 @node Git
2 @cindex git integration
3 @pindex git-bundle
4 @section Integration with Git
5
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
9 everything you need.
10
11 Use it to create bundles containing all required blobs/trees/commits and tags:
12
13 @example
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
17 @end example
18
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
21 transfer them:
22
23 @example
24 $ git bundle create repo-$(date '+%Y%M%d%H%m%S').bundle last-bundle..master
25 or maybe
26 $ git bundle create repo-$(date '+%Y%M%d').bundle --since=10.days master
27 @end example
28
29 Received bundle on remote machine acts like usual remote:
30
31 @example
32 $ git clone -b master repo-XXX.bundle
33 @end example
34
35 overwrite @file{repo.bundle} file with newer bundles you retrieve and
36 fetch all required branches and commits:
37
38 @example
39 $ git pull # assuming that origin remote points to repo.bundle
40 $ git fetch repo.bundle master:localRef
41 $ git ls-remote repo.bundle
42 @end example
43
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
50 difference.
51
52 Also you can find the following exec-handler useful:
53
54 @verbatiminclude git-bundler.sh
55
56 And it allows you to request for bundles like that:
57 @code{echo some-old-commit..master | nncp-exec REMOTE bundler REPONAME}.