Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git bundle: bundle tags and heads

Tags:

git

bundle

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.

like image 787
MaxB Avatar asked Apr 19 '11 16:04

MaxB


People also ask

Does git bundle include tags?

git bundle will only package references that are shown by git show-ref: this includes heads, tags, and remote heads. References such as master~1 cannot be packaged, but are perfectly suitable for defining the basis. More than one reference may be packaged, and more than one basis can be specified.

What does git bundle do?

Bundles are used for the "offline" transfer of Git objects without an active "server" sitting on the other side of the network connection. They can be used to create both incremental and full backups of a repository, and to relay the state of the references in one repository to another.

Can you push to a git bundle?

You cannot push directly to a bundle file. A bundle file is a compressed representation of a repository, and to modify it would involve unbundling, pushing, and bundling again. One way to do this is as you said, create a new bundle every time you want to make a backup.

Does git archive preserve history?

Use Git Archive for Files The available list of formats can be retrieved with the git archive --list command. But the Git archive command includes only the files, not the history of those files. You can also use git archive branch to see the history of your branch/tree.


1 Answers

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.

like image 52
VonC Avatar answered Oct 07 '22 17:10

VonC