Skip to main content

The right way to email a git repository

· 2 min read
Brian Graham
Consultant

You're tasked with reviewing the code challenge of another candidate. You download the project.zip file, extract it, and it doesn't run. You can't tell what part of the code is auto-generating scaffolding, or what part is the complex part. You can't really get an idea of if the code would work, or was even written by the candidate. You don't even know if they did the entire project in one big commit or not. As long as there's nothing horribly wrong, you'll pass them.

Most companies have some kind of code challenge in their interview process. While you may like or dislike this practice for different reasons, one thing that can easily remove a bunch of headaches here is to stop asking for zip-files of that project.

Git Bundle: A Better Solution​

Git already provides a wonderful feature called a "git bundle". It is a way to package a git repository into single file which contains the entire git repository, and even branches. Generating one is the easiest thing imaginable. If your present working directory is inside a repository, you can simply run this command:

git bundle create your_name.bundle --all
File Naming Convention

There's no real convention for the file name. I personally just prefer receiving interview challenges with the name of the candidate and a meaningful extension.

How to Use the Bundle​

Ask the candidate to send you the file (I haven't had any spam issues with gmail so far). On your side simply download the file and clone it to a new folder somewhere:

git clone <path_to_bundle_file>

This works exactly like doing any normal git clone: a new folder is created with the entire project, except the "origin" is a local file (the bundle) instead of a web address to something like GitHub.

Interactive tutorial​

📦 Git Bundle Interactive Demo

See how git bundles work in practice

🌳 Workflow Steps

1
Navigate to your repository
cd /path/to/your/project

First, navigate to your git repository directory

2
Create the bundle
git bundle create interview_challenge.bundle --all

Package your entire git repository into a single file

3
Verify the file was created
ls -lah interview_challenge.bundle

Check that the bundle file was successfully created

4
Clone from bundle (recipient)
git clone interview_challenge.bundle project_review

The interviewer can now clone directly from the bundle. This is also a good way to verify the bundle is valid.

💻Terminal
Click "Run Step" to see the command execution...

Additional Resources​

Of course, there are many more use cases for this feature than simple code interview submissions, and additional features I haven't described. For more details, you can also review the Git Bundle Documentation.