Back to Blogs

Best practices with Branches

Austin ChenJul 25, 20234 min read

Talk to an expert

about something you read on this page

Contact an expert
PULSE_HeadlessCMS.png

Content creation and management can be a complex process, especially for enterprises with large-scale content operations involving multiple teams. To streamline workflows and enhance collaboration, the Contentstack Headless CMS offers independent workspaces—known as Branches—for developers to work on content models, facilitating the safe development of new features or significant changes and enabling content editors to continue to work in production without any interruptions.

Branches are independent copies of your content repository that allow team members to work on different content models simultaneously. Branches allow you to create multiple copies of your stack content. Every stack has a main branch by default. To create a new branch, you can fork a branch off of the main branch. When you create a branch for the first time, the main branch becomes your source branch. For all subsequent branches you create, you need to specify a source branch from which it will inherit data. These branches provide a secure and isolated environment where changes can be made, reviewed, and merged back into the main content model seamlessly.

Real-world use cases

Agile development

Branches aligns perfectly with the Agile development methodology. Developers can create separate branches for a new set of related changes, enabling development to happen without disrupting content efforts. This approach enables continuous integration and seamless merging, ensuring a steady flow of updates and enhancements while maintaining stability.

Isolated content development

With Branches, developers can work on specific features, campaigns, or updates in parallel, without the fear of conflicting with editor's production changes. Developers and content managers can work concurrently on different copies of the same content without data loss. This isolation fosters efficient development and minimizes the risk of errors or content discrepancies.

Compare & Merge

With the Compare Branches feature, you can compare the differences between two branches. If you make changes to your content model in a branch and want to see what’s different, you can use this to do so. Once you are satisfied with your changes, you can integrate the changes in the current branch into another branch using the Merge Branches feature. You can merge two branches with the following strategies:

  1. Prefer base: This enables you to add changes from the compare branch to the base branch, and when conflicts arise, it keeps the changes in the base branch and ignores the changes in the compare branch. Anything present in the base branch but not in the compare branch will be kept.

  2. Prefer compare: This enables you to add changes from the compare branch to the base branch, and when conflicts arise, it keeps the changes in the compare branch and discards the changes in the base branch.

  3. Overwrite with compare: This allows you to completely replace the base branch with the changes from the compare branch. Anything in the base branch that is not present in the compare branch will be lost.

  4. Merge new only: This allows you to merge only the new changes from the compare branch to the base branch and ignores any modified changes in the compare branch.

  5. Merge modified with prefer base: This allows you to add only the modified changes from the compare branch to the base branch. When conflicts arise, it keeps the modified changes of the base branch and ignores the modified changes of the compare branch. Any new items in the compare branch are ignored.

  6. Merge modified with prefer compare: This allows you to add only the modified changes from the compare branch to the base branch. When conflicts arise, it keeps the modified changes of the compare branch and ignores the modified changes of the base branch. Any new items in the compare branch are ignored.

  7. Ignore: This allows you to ignore all changes from the compare branch, keeping the base branch as it is. This can be used to ignore a specific change or to ignore all changes and merge only specific changes.

Key benefits

Collaborative workflow

Branches promotes a collaborative content development process by enabling multiple contributors to work simultaneously on different aspects of a project. Teams can experiment, iterate, and refine their content models and test automated content updates without disrupting the main content repository.

Efficient content review

Branches provides a controlled environment for content model review and testing big scripted changes. Team members can review and provide feedback on the proposed changes before merging them into the main content repository. This ensures content quality and consistency while facilitating effective collaboration and knowledge sharing.

Easy rollbacks

In case an issue arises or an experiment doesn't yield the desired results, Branches and Aliases allows for easy rollbacks without affecting the main content repository. Developers can maintain production content across different branches without affecting live website data. Aliases can always point back to the previously referenced content branch in case of unintentional content deployment. This feature provides a safety net, allowing developers to experiment and explore innovative ideas without fear of irreversible changes.

Branches is a valuable feature that empowers developers and business users to work efficiently, collaborate seamlessly, and deploy changes confidently. By embracing best practices and leveraging Branches effectively, teams can unlock new levels of productivity, accelerate development cycles, and deliver exceptional digital experiences. Branches serves as a catalyst for engineering innovation, ensuring that businesses stay ahead of the curve in an ever-evolving digital landscape without disrupting editors in production.

If you’re fascinated by the possibilities around streamlined development and innovation flexibility, we invite you to dive into our Branches documentation.

About Contentstack

The Contentstack team comprises highly skilled professionals specializing in product marketing, customer acquisition and retention, and digital marketing strategy. With extensive experience holding senior positions in notable technology companies across various sectors, they bring diverse backgrounds and deep industry knowledge to deliver impactful solutions.  

Contentstack stands out in the composable DXP and Headless CMS markets with an impressive track record of 87 G2 user awards, 6 analyst recognitions, and 3 industry accolades, showcasing its robust market presence and user satisfaction.

Check out our case studies to see why industry-leading companies trust Contentstack.

Experience the power of Contentstack's award-winning platform by scheduling a demo, starting a free trial, or joining a small group demo today.

Follow Contentstack on Linkedin

Share on:

Talk to an expert

about something you read on this page

Contact an expert

Recommended posts