Speedup a developer’s onboarding on a software project with git-bundle
Sharing git repositories without a zipping mess.
Disclaimer: Sharing is caring, but please only do so if you are allowed to. Please always make sure that all copyrights and policies are respected. Data leaks and lawyers are not to be messed with.
Often you start on a new project and initially a lot of time is required to be granted access to all systems. Until you really have access to the repository and are able to deliver the first features, a couple of days or weeks may pass. Most of the time this is not necessary because you are not allowed to access the code base directly anyway. Usually there are a lot of other systems (and people) involved with different responsibilities and rights, so it takes ages to get the final approval.
Legal certainty does not come from button clicks alone and is usually recorded separately in contracts, which are often already signed. So in most cases, you should already be legally able to work with the code, but the process takes time.
But I recently figured out that git already provides a powerful feature to solve this bottleneck and allowing you and your colleagues to become more productive. It’s called git-bundle and this is how it works (at least for me 😉).
Package and ship everything nicely
To wrap the code base, first you need the actual repository. Clone it and you can start packaging.
git clone https://fancy-url.tld/git/creative-name-here
git bundle create creative-name-here.bundle develop
That’s it. Copy and transfer the created bundle securely to the target system and simply clone from this file.
git clone -b develop /path/to/creative-name-here.bundle repo-name
Now you can simply work with this repository like you would usually. Create your feature branch and do whatever you want.
Reverse direction
As soon as you’re done with your coding, you can just bundle it again. Create a new bundle e.g. from your feature branch.
git bundle create feature-xyz.bundle feature/xyz-1234
Transfer this file to your previous machine with the proper repository which has access to the remote and fetch the branch from the bundle.
git fetch ../feature-xyz.bundle feature/xyz-1234:feature/xyz-1234
Merge the latest changes from your develop branch to avoid conflicts or solve them if needed and simply push the feature branch to the origin. Or if you prefer rebase
, then do it the way it suits you.
git checkout feature/xyz-1234
git merge origin/develop
git push --set-upstream origin feature/xyz-1234
Finally you can open a PR and wait for approvals. 😄
Last but not least, I would like to refer again to the main article of git itself, which also mentions all the other features of git-bundle like list-heads
or verify
.