Branches and publishing in Nordcraft
Branches in Nordcraft allow you to develop new features or fix issues without affecting the live version of your project. They provide a safe environment to make and test changes before making them available to users.
Understanding branches
When you create a new project, Nordcraft automatically creates a branch called start
for you. The main
branch represents what your users see. You cannot edit the main branch directly, but you can view it in the editor.
Branches work like branches on a tree:
- Your
main
branch is the trunk that users see - New branches grow from this trunk
- When a branch is complete, it can be merged back into the trunk
- When a branch is merged, it becomes becomes part of the trunk
If you're familiar with git version control, Nordcraft branches work in the same way.
Advantages of branches
Using separate branches for individual features or fixes provides several benefits:
- Isolated development: Work on specific features without impacting other work in progress
- Easier collaboration: Reduce coordination overhead when multiple people work on the same project in parallel
- Stability of live version: The main branch remains stable with completed and tested features only
- Simplified testing: Test changes independently before publishing
- Reduced risk of conflicts: Minimize conflicts from simultaneous edits to the same project
Keep branches small and short-lived. A branch should contain just a single feature like add-color-picker
or fix-dialog-styling-issue
.
Working with branches
Create a new branch
- 1On the project details page, click the Create branch button
- 2Choose a descriptive name for the branch and confirm
When the branch is created, you are automatically taken to the editor to start working on that new branch.
You can have multiple active branches at the same time, each focusing on a different feature or fix.
Preview a branch
You can preview your branch to test changes before publishing.
- Select your branch and click the Preview option
- This opens a preview at
branch-project.nordcraft.site
- You can share this preview link with others for feedback
- All changes made on a branch are automatically synced to the preview link
View changes
When working in a branch, you can view all modifications made and compare them to the state of the main branch.
- Click the View changes button in the bottom bar of the editor or in project details
- Review all modifications made in your current branch
- Identify any conflicts that need resolving before publishing
- 1Enter a description for your changes
- 2Publish your branch
- 3Navigate back to project details
- 4Navigate back to this branch's editor
- 5Delete your branch
- 6Reset all changes for the selected page or component
- 7Edit the selected page or component directly
Publish changes
When you're ready to make your changes live:
- 1Enter a short description to your update (make your description descriptive, this will help you later in case you need to roll back)
- 2Click the Publish branch button
Your changes will be merged into the main branch and become visible to users immediately.
Sync with main
Before publishing, your branch must be up to date with the latest changes in the main branch. If someone else has published changes since you created your branch, it will no longer be up-to-date, and you will need to sync with the main branch:
- 1Click the Sync with main button to pull the newest version of the main branch into your working branch
- 2Once synchronized, you can publish your changes
Resolve merge conflicts
Merge conflicts can occur when two branches have made changes to the same section of code. When this happens:
- 1Nordcraft will identify and highlight the conflicting changes
- 2You will need to decide which changes to keep:
- Reset your branch's changes to use the main branch version
- Reset main's changes to keep your branch's version
- 3For each conflict, select the appropriate reset option
After resolving all conflicts, you can complete the sync with main.
When you reset a change, that version will be discarded. Make sure you understand what each change contains before deciding which changes to keep.
If you have changes you need to preserve when resolving conflicts, consider copying those changes to a new branch (which will automatically be in sync with main
).
Roll back changes
If you discover issues on your live project after publishing, you may need to revert to a previous version of your project. This is known as a rollback.
- 1Go to the version history section in project details
- 2Find the version you know worked correctly
- 3Click the Rollback button next to that version
- 4Confirm the rollback
This will restore your live application to the selected version state immediately, overwriting the current version.
Rolling back is a significant action that affects your live application. Make sure you have selected the correct version before confirming.