Focus on development workflows, coding standards, and Git flow practices. Include sections for each aspect of Git flow, coding standards, and other technical best practices our /team should follow.
- Start New Features: When beginning work on a new feature, create a feature branch off the
develop
(orpreview
, if you've chosen to rename it, which we did) branch. Use the conventionfeature/your-feature-name
. - Finish Features: Once a feature is completed and tested, merge it back into the
develop
branch. Delete the feature branch if it's no longer needed.
- Continuous Integration: Regularly push changes from feature branches into this branch to integrate and test new developments. If you're using
preview
as your integration branch, this serves as a live staging area for your team to review.
- Prepare Releases: When you're ready to prepare a new release, create a release branch off
develop
. Use the naming conventionrelease/x.y.z
based on your versioning. - Finalize and Merge: After final testing and adjustments, merge the release branch into
main
(ormaster
) and back intodevelop
to capture any last-minute changes made during the release process. Tag the merge intomain
with the version number.
- Urgent Fixes: For urgent fixes to your production code, create a hotfix branch directly off
main
. Name it using the conventionhotfix/urgent-fix-name
. - Merge Back: Once the fix is complete, merge the hotfix branch into both
main
anddevelop
(orpreview
), ensuring that the fix is incorporated into future releases.
- Production Ready: The
main
branch represents the production-ready state of your project. Only merge intomain
from release or hotfix branches.
- Tag Releases: When you merge a release into
main
, tag the commit with the version number to mark the release point. If you've set up aversion/
prefix for tags, include it in your tag name.
- Regular Pulls: Regularly pull changes from the remote to keep your local branches up to date and minimize merge conflicts.
- Branch Cleanup: Delete branches after merging them to keep your repository clean and manageable.
- Communication: Ensure all team members are familiar with the Git flow process and the roles of different branches. Clear communication is key to avoiding confusion.
If you've fast-forwarded the preview
branch to the last commit of the main
branch and then checked out to the preview
branch, you've effectively synchronized the preview
branch with the current state of main
. This setup positions the preview
branch to receive all future updates and changes intended for pre-production or staging review before they are merged into main
, aligning with the workflow you seem to be establishing.
-
Committing to
preview
: With thepreview
branch checked out, any new commits you make will now be part of thepreview
branch. This is ideal for introducing and testing new features, bug fixes, or other changes without affecting the production-readymain
branch. -
Review and Testing: Use the
preview
branch as a staging area to review changes, conduct tests, and ensure everything works as expected in an environment that mirrors production as closely as possible. -
Pull Requests for Merging: When you're satisfied with the changes in the
preview
branch, create a pull request (PR) to merge these changes intomain
. This PR process facilitates code review and discussion among team members, ensuring that only thoroughly vetted changes make their way to production. -
Continuous Deployment with Vercel: If your project is integrated with Vercel, remember that Vercel automatically creates preview deployments for every push to branches other than
main
. This means that pushing changes to thepreview
branch will generate a preview deployment that you can share with your team or stakeholders for feedback. -
Keeping
preview
Updated: Periodically, you may want to sync thepreview
branch with themain
branch to ensure it reflects the latest production state. This can be done through a fast-forward merge frommain
topreview
, similar to what you've already done, or through a regular merge if the branches have diverged significantly. -
Communication: Ensure that all team members are aware of the workflow and understand that the
preview
branch is where updates should be pushed for pre-production review.
This workflow allows your team to efficiently manage and review changes in a controlled environment, reducing the risk of introducing errors into the production codebase.
By adhering to these practices, you can leverage Git flow to streamline your development process, improve collaboration, and manage releases more effectively.