Configuring your Custom Workflows Branches
Configuring your branches properly is the foundation of an effective Custom Git Workflow. By setting up clear roles and relationships between your branches, you create a predictable development environment that reduces errors and improves team collaboration. This configuration ensures that changes flow smoothly through your development pipeline while maintaining the flexibility to adapt to your project's specific needs.
For a comprehensive overview of Custom Git Workflows and their benefits, see the workflows overview.
Configuring Base Branches
Base branches form the backbone of your workflow, serving as the long-lived branches that persist throughout your project's lifecycle. Understanding how to configure these branches effectively is crucial for maintaining a stable and organized development process.
Trunk Branches
Trunk branches represent your primary development lines and serve as the ultimate destination for your code. These are typically branches like main
or master
that contain your production-ready code. Trunk branches act as the root of your branch hierarchy and don't have parent branches themselves.
When you designate a branch as a trunk branch, Tower recognizes it as a foundational element of your workflow. This means that other branches can depend on it, but it doesn't depend on any other branch in your configuration.
Base Branches with Parent Relationships
Base branches can have parent-child relationships that define how changes should flow through your development process. For example, you might have a develop
branch that serves as a child of your main
trunk branch, or a staging
branch that inherits from develop
.
These parent-child relationships are powerful because they establish clear pathways for how features and fixes should be integrated. When you set up these dependencies, Tower can automatically track when child branches need updates from their parents and suggest the appropriate actions.
Auto-Updates When Parent Changes
One of the most valuable features of Custom Git Workflows is the ability to automatically keep child branches synchronized with their parents. When you enable auto-updates, Tower monitors your parent branches and notifies you when child branches become outdated.
Important Auto-updates only take effect when topic branches are merged using the "Finish" action in Tower's workflow system. This ensures that updates happen at the right time in your development process.
This automatic synchronization prevents the common problem of feature branches becoming increasingly out of sync with their base branches, which often leads to complex merge conflicts later in the development process.
Merge Options
For each base branch, you can configure specific merge strategies that define how changes are integrated. Tower supports several merge options:
- Merge commits create explicit merge commits that preserve the branch history and make it clear when features were integrated
- Squash merging combines all commits from a topic branch into a single commit, creating a cleaner linear history
- Rebase replays commits from the topic branch on top of the base branch, maintaining a linear history without merge commits
You can also configure whether to automatically create tags when merging upstream, which is particularly useful for release workflows where you want to mark specific points in your project's history.
Configuring Topic Branches
Topic branches are the short-lived branches where your actual development work happens. Configuring these branches properly ensures that your team can create, work with, and integrate features efficiently.
Benefits of Topic Branch Configuration
Well-configured topic branches provide several key advantages. They ensure consistent naming conventions across your team, making it easy to understand what each branch contains. They also establish clear starting points for new work and define predictable merge strategies that maintain your desired history structure.
By configuring topic branches with appropriate prefixes like feature/
, bugfix/
, or hotfix/
, you create an organizational system that helps team members quickly understand the purpose and scope of each branch.
Merge Options
Just like base branches, topic branches can be configured with specific merge strategies. However, topic branch merge options typically focus on how the branch will be integrated back into its parent or base branch.
You can configure topic branches to use squash merging for cleaner commit histories, or preserve individual commits when you want to maintain detailed development history. The choice depends on your team's preferences and the level of detail you want in your project's commit log.
Starting Point Options
Topic branches need to know where to begin their development work. You can configure default starting points for different types of topic branches, ensuring that new features start from the appropriate base branch and hotfixes begin from the correct production branch.
This configuration eliminates guesswork for developers and reduces the chance of starting work from the wrong branch, which can lead to integration problems later in your development cycle.