git bundle
Gabriel Guzman
May 30
I had an interesting problem at work the other day. We'd hired some external contractors to build an android app for us, and now we needed to get the code from them and into our private GitHub. The problem was, I couldn't quickly get them access to the repo since there's a fair amount of process involved in getting those approvals. They also didn't have enough seats to add me as a contributor to their GitHub account, and so we were stuck with me asking them to send a .zip file with the code. Instead, they came back to me with a git bundle file, which I'd never heard of (though I've been using git for a long time now). A git bundle file is essentially a full repository in a single file. You can have branches, history, tags, basically everything you expect in a repository, but it's all contained in a single file. This makes sharing the repository or moving the full repository pretty straightforward. Assume I have a git project called myproj, and I want to send that to someone else.
host1$ cd myproj
host1$ git bundle create repo.bundle master
That will make a bundle file (repo.bundle) that contains all the history of the master branch. You can then send this file to a friend, and they can clone it just like if it were a remote git origin:
host2$ git clone -b master ./repo.bundle myproj
host2$ cd myproj
host2$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Another pretty neat thing about git bundles is, if you need to update one, you can send an incremental file update with only the latest changes. The recipient just puts that in place of their existing bundle, and runs git pull w/in their repo.
This isn't something you'd use every day, but in certain situations (like getting a git repo from one place to another w/out being able to share a remote origin) it works great!
More info on git bundle: https://git-scm.com/docs/git-bundle
The best way to structure React Native git project?
Elazizi Youssouf - Aug 23
Git commands to keep a fork up to date
Phil Nash - Aug 21
Front-End & Back-End Development Teams Are Mushrooming Everywhere Separately!
Rooney Reeves - Aug 24
Git merge specific file from another branch
Alex Ruzenhack - Aug 23
DHCP
Good Practices - Code Review Comments
Trending on dev.to
[TIL] int vs short and the (unexpected) performance impact
My Git Aliases
The best way to structure React Native git project?
Calculating Prime Numbers with CircleCI
Git commands to keep a fork up to date
Git merge specific file from another branch
How to Fix that Heroku Push Error!
How to Start Android App Development on Android
143
27
I wish I was aware of this a few months ago. We ended up sharing a repo inside a corporate dropbox, so everyone sees a steady stream of updates to index files and occasionally can't push because someone checked out the shared repo to a branch. Using a bundle instead of a normal repo would have solved those issues quite neatly.
This is great! Now we just have to upload the file on a server then share it so others can download it then pull or update changes from/to their machines. Let's call it GitClub... oh wait...
jk, this is super useful to me :D
Hahahahah
Been using git's
bundlefunctionality for a couple years to keep private (read-only) repositories in sync with public (cardinal) repositories. Much more space-efficient when you're trying to push repo-updates over network-links that are limited-bandwidth - both in absolute bits-per-second and in maximum payload-size.Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)
Please consider creating an account on dev.to. It literally takes a few seconds and we'd appreciate the support so much. β€οΈ
Plus, no fake comments when you're signed in. π
I literally didn't see that coming.. π
Never heard of that, but it sounds like it could be useful in a pinch. Perhaps it also has some (very basic) backup applications, if you want to easily create a backup of a single branch. Thanks for sharing!
Never ever heard about that. Is going to save my ass in a not distant future for sure. Now I am thinking if could have any difference when working with gitlab and/or github migration.
Great work!
Thanks, yeah it was new for me as well! Not something I'll use every day, but definitely good to know about.
That's pretty neat!
...and I was doing it manually all these years.
Very useful! Thank you!
I actually needed something like this on an offline server not long ago!
Thank you for that info!
Very useful! Thanks Gabriel
Woh never heard of this. Thanks for sharing it.