How to share only a specific git branch with collaborators

What if you want to share only a cer­tain branch with a col­lab­o­ra­tor with­out hav­ing to share the entire code­base? Zip­ping is not an effec­tive solu­tion since it does not pre­serve the com­mit his­tory. This is when git bun­dle can come in handy. It lets you cre­ate a clone­able bun­dle using the branch you spec­ify dur­ing bun­dle creation.

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

This cre­ates a file from which you can clone the fea­ture branch with all of its com­mit 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 *