6 ms·
Cool, I didn't know about 'git bundle'; nice to have another tool in my arsenal :) I like to keep a bare copy of each repo locally, and use those as remotes fo
by chriswarbo 3y ago
Cool, I didn't know about 'git bundle'; nice to have another tool in my arsenal :)
I like to keep a bare copy of each repo locally, and use those as remotes for my "working copies". The `git worktree` command can be used in a similar way, but I feel safer using separate clones.
The article focuses on removable media (USB drives, CDs, etc.) which make automation awkward. If your remotes are more reliable (e.g. on the same machine, a LAN, or indeed the Internet) then git hooks can be useful, e.g. to propagate changes. For example, my local bare repos used hooks to (a) push to remotes on chriswarbo.net, (b) push to backups on github, (c) generate static HTML of the latest HEAD, and copy that to chriswarbo.net and IPFS.
Since the article mentions bundles, a related feature is git's built-in mail support. This can be used to convert commits into a message, and apply a message as a patch. I've used this a lot to e.g. moves files from one project to another (say, helper functions from an application to a library) in a way which preserves their history (thanks to https://stackoverflow.com/a/11426261/884682 https://stackoverflow.com/a/11426261/884682 )
- TacticalCoder 3y agoAnd converting a Git repository to a bare Git repository is super easy (and can be done at any time). I keep my bare Git repositories on another machine on my LAN and push/pull/fetch/whatever using SSH (typically from Emacs, using Magit).
- eichin 3y agoI'm a little surprised that they talk that much about removable media without ever mentioning Git Annex...
- kristjansson 3y agoDoes git-annex bring anything if you're directly committing everything to git?
- 0cf8612b2e1e 3y agoI do not follow what you do with the bare repos. Is it just a local backup? A staging repo for tricky operations?