Clean up your branch before merging

1: Update from the main branch
2: Resolve merge conflicts
3: Cleaning up your branch — you’re here 📍

Now you’ve completed the update branch flow and you’ve brought in changes from the main or parent branch. However, your files might not be in a state to be merged to the main branch yet, or you might still have work to do on your branch. Here are some tips on how to clean up your branch based on which workflow you went with.

Clean up your branch with duplicated artboards

In Step 2 of the merging guide, you duplicated the artboards to bring in updates from the main branch while also keeping the designs in your branch. This means you have some clean-up work to do. Let's make sure the end result of your merge is organized and polished.

  1. Open up the file(s) that had merge conflicts. 
  2. For each duplicated artboard, copy and paste the items you want to keep from the duplicate to the original artboard. It is important to keep the original artboard in order to maintain the history of the main branch. This also helps prevent collections from being rendered with missing previews.
  3. When you’ve consolidated all of the changes that you wanted to keep onto the original artboards, delete the duplicates.
  4. Save and make a clean-up commit.

Get back work from a previous commit

In Step 2 of the merging guide, you chose the artboards from main, overwriting your current branch’s progress. To prepare your file for merging, you might need to bring back some of the work that was overwritten.

  1. In your branch, go to the commits tab.
  2. Find a previous commit from before the update from the main branch commit you just created.
  3. Click Open Untracked to open a copy of the file from that commit.
  4. Copy and paste the items you want to keep from the untracked file into the current file.
  5. If there were any symbols copied over from the older file, make sure that they are still linked correctly in the current file.
  6. Repeat steps 3-5 for each file that you had been working on in your branch.
  7. When you’ve updated all of the artboards that you intend to keep, you can close out the untracked file(s).
  8. Save and make a clean-up commit.

Bring in select changes from the main branch

In Step 2 of the merging guide, you chose the artboards from your current branch. While this lets you to continue working in your branch without having to get your work back, it also means that when you merge to the main branch you’ll overwrite the artboards where there were conflicts.

You can still bring in select artboards from the main branch (or a parent branch) by following these steps.

  1. Go to the main branch (or the parent branch) from which you updated.
  2. Right-click to Open Untracked or click the Edit in Sketch button and select the open untracked option.
  3. Copy and paste the items you want to bring in from the untracked main branch file into the current file.
  4. If there were any symbols copied over from the main branch or parent branch file, make sure that they are still linked correctly in the current file.
  5. Repeat steps 2-4 for each file that you had been working on in your branch.
  6. When you’ve brought in all of the changes that you need, you can close out the untracked file(s).
  7. Save and make a clean-up commit.

Be careful about restoring commits after you update from the main branch. After you click Update from the main branch... or Update from parent... and go through the conflict resolution workflow, you've essentially told Abstract that there are no more conflicts between your branch and the main branch, and you are able to merge your branch when you want.

If you need to clean up your files or you discover that you should have selected the artboard(s) from the main branch but you had actually selected the ones in your branch, it can be tempting to restore to a prior commit. The risk here is that when you restore to a commit from before the update, you won’t get the Update from Main... button again, and you may end up overwriting all of the changes in the parent. Instead, you should use the steps outlined above to open the needed file(s) untracked and keep moving forward to fix your branch.