How to share only a specific git branch with collaborators

What if you want to share only a certain branch with a collaborator without having to share the entire codebase? Zipping is not an effective solution since it does not preserve the commit history. This is when git bundle can come in handy. It lets you create a cloneable bundle using the branch you specify during bundle creation.

cd projectDirectory
git bundle create ../my-feature-branch.bundle -b feature-branch

This creates a file from which you can clone the feature branch with all of its commit history.

git clone my-feature-branch.bundle -b feature-branch

Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *