When you want to merge your branch with the base branch -
- Click on the Merge button at the bottom left corner of the screen. It will open the merge tab
- Select your base branch and check the merge status
headbranches shouldn't have any uncommitted changes.
- The remote counterpart of the
basebranch shouldn't have any commits that are missing locally (the local and remote versions should be in sync.)
headbranch shouldn't have any conflicting changes.
- Click on
Merge Changesif the merge status check is successful.
Consider a scenario where user 1 wants to develop a new feature and has a single branch main. As a general practice, the user creates feature-f1 from the main branch. At the same time, user 2 updates the main branch with the same resources like page, query, or JSObject that user 1 modifies on the feature-f1 branch. If user 1 tries to merge feature-f1 to the main branch, it creates a merge conflict.
You can resolve it in the following way:
- Create a pull request with
mainas the base branch;
- Resolve the conflicts on remote branches (Between
- Once the conflicts are resolved, merge this new branch(
origin/feature-f1) into the old branch(
- Pull the
mainbranch again in your app. Now you should have all the changes from the
- Delete branch
origin/feature-f1on the remote repository;
- Sync branches in the Git branches modal on Appsmith to remove
origin/featuref1from the local repository.
Best practices to avoid merge conflicts
Merge conflicts can occur when different branches attempt to merge changes to the same page of an app. Multiple developers can collaborate on the same app, but each one should focus on a different page.
For changes that affect more than just one page of the app, like the app theme, datasources, etc:
- Avoid making these changes when feature branches are in the middle of building new updates.
- Ensure that these changes are completed and pushed to the
- Pull changes from
mainto the feature branches that are in development.
- Finish updates on the feature branch, then commit and merge with main.