To improve your development workflow and ensure your Git branches and Bit lanes are in sync, add a post-checkout hook to your local repository. This hook automatically creates a lane in Bit for every new branch you create locally. When you switch between branches, the hook also switches your workspace to the corresponding lane.
- Download these files.
- Place the
create-lane.js
file anywhere in your local repository. - Place the
post-checkout
file in your local repository's.git/hooks
directory. Update the path in this file to match the location of thecreate-lane.js
file. - Make sure the
post-checkout
file is executable. If it's not, runchmod +x .git/hooks/post-checkout
.
To ensure that your lane is exported with recent updates, before pushing changes to the remote, add a pre-push hook to your local repository.
- Download these files
- Place the
export-lane.js
file anywhere in your local repository. - Place the
pre-push
file in your local repository's.git/hooks
directory. Update the path in this file to match the location of theexport-lane.js
file. - Make sure the
pre-push
file is executable. If it's not, runchmod +x .git/hooks/pre-push
.