问题
I develop on several machines. I want to have a repository for each of my projects on each development machine, and I would like to keep them in sync without using a remote repository I can push to. (For now I cannot afford a dedicated machine for that purpose).
I think git bundle is the right tool for the job. I simply bundle my repo when I am done working on machine A, and unbundle on machine B. This leaves me with this questions:
Is it possible to embed information about tags and branches in the bundle? In particular, how can I bundle tag objects?
EDIT: Just a note aside - I want to keep this workflow as automated as possible. I do not want to treat the bundle as a remote. Rather than that, I would like to duplicate the bundle into my repository - that is add commits and tags, fast-forward existing branches and add new branches if the branch does not exist.
回答1:
git bundle create RA.bundle --branches --tags
would include informations about all tags and all branches.
git bundle takes a list of arguments, acceptable to git rev-parse and git rev-list (and containing a named ref, see SPECIFYING REFERENCES), that specifies the specific objects and references to transport.
--branches[=<pattern>]
Pretend as if all the refs in
refs/heads
are listed on the command line as<commit>
.
If<pattern>
is given, limit branches to ones matching given shell glob.
If pattern lacks?
,,
or[
,/
at the end is implied.
--tags[=<pattern>]
Pretend as if all the refs in refs/tags are listed on the command line as
<commit>
.
If<pattern>
is given, limit tags to ones matching given shell glob.
If pattern lacks?
,,
or[, /
at the end is implied.
来源:https://stackoverflow.com/questions/5719369/git-bundle-bundle-tags-and-heads