]> git.proxmox.com Git - ceph.git/blame - ceph/README.git-subtree
bump version to 12.2.10-pve1
[ceph.git] / ceph / README.git-subtree
CommitLineData
7c673cae
FG
1Some libraries that Ceph uses are incorporated into the build tree
2through a technique known as git subtrees. This is an alternative to
3git submodules, which is also used in Ceph.
4
5One such library is the dmclock library. Here are some basic notes on
6the use of git subtrees.
7
8When a subtree is added to the repo, commands such as these were run
9from the top-level ceph directory:
10
11 git subtree add --prefix src/dmclock \
12 git@github.com:ceph/dmclock.git master --squash
13
14That essentially brings in a full copy of the library into the
15subdirectory src/dmclock, but squashes all the commits into a single
16one.
17
18If in time the library is updated and you'd like to bring the updates
19in, you could run:
20
21 git subtree pull --prefix src/dmclock \
22 git@github.com:ceph/dmclock.git master --squash
23
24WARNINGS
25
261. A rebase should NEVER include the commits by which a subtree is
27added or pulled. Those commits do not include the prefix that was used
28for the subtree add/pull, and therefore the commits are applied to the
29wrong files or, more likely, to non-existant files. If something like
30this must be done, a workable approach is to a) do an interactive
31rebase, b) remove the commits for the former subtree add/pull, and
32either c) replace those commits with executions (x/exec) of the
33commands used to add/pull the subtrees, or d) do those commands from
34the command-line by using (e/edit) on preceding commits.
35
362. If you'd like to modify the library contained in a subtree you'll
37need to choose whether to just change your subtree and maintain those
38differences into the future (until the library incorporates them) or,
39if you're able, modify the library and use a "git subtree pull ..." to
40bring them in.
41
423. If you modify the library within the ceph tree, then it's best not
43to combine changes within the subtree and outside the subtree in a
44single commit. Each commit should either only contain changes within
45the subtree or outside the subtree. That gives you the option to
46cleanly push those changes back to the library's repo. That way if you
47ultimately decide to make the changes to the library, you can easily
48remove the subtree commits.