This feature is available from the Pro plan and above. Please note that it is available only for "Software localization" type of projects, but not for "Documents".
The development process often requires you to work on multiple branches. Lokalise supports branching similar to GitHub, with some limitations (see below).
Understanding merging (examples)
What is branching?
To put it simply, a branch is a separate version of your translation project. When the branching feature is enabled for a project, this project can have multiple independent versions. You can switch between these versions, delete them, and merge changes from one version into another.
For example, suppose you have a
welcome key with the "Welcome to the app!" translation value. You enable branching and create two branches:
develop. Initially the
welcome key has identical translations in both branches, however you can switch to the
develop branch and modify the key's value to "Welcome to our app". This change will not affect the translation value stored in the
master branch (it will still contain "Welcome to the app!" text).
Now you can decide which translation suits best. If you prefer the
master version, then simply delete the
develop branch, otherwise you can merge the
develop branch into
master thus incorporating all the recent changes from
develop. This is very convenient because with branches you can safely experiment with your keys and translations without worrying that your changes might affect the "main" version of the project.
Please be aware that certain project elements are global (in other words, do not support branching) as explained in the corresponding section.
If the branching feature is included in your subscription plan, you can enable it by proceeding to More > Settings:
Tick the Branching checkbox under the General tab, Miscellaneous section. Don't forget to click Save changes in the bottom afterwards:
Once enabled, the Branches tab will appear in the project settings. You can add, delete, and merge branches there.
By default, a single branch called master will be created for you. You can create additional branches either under the Branches tab in the project settings, or directly from the branch selection dropdown (in the Editor or at the projects dashboard):
Branch names have certain restrictions:
must start with a letter or number or dot
must end with a number or letter
may contain numbers, letters, and
. - _ /characters
multiple consecutive slashes are not allowed
multiple consecutive dots are not allowed
no slash-separated component can begin with a dot
no slash-separated component can end with the sequence
minimum length is 2 characters
maximum length is 100 characters
Once you are done working on a branch and would like to merge it (in other words, take the changes from this branch and incorporate those into another one), there are several things you should consider:
Merging is not available when there are active tasks or orders on the target branch.
Conflicts can be resolved before merging.
Merge operation is irreversible.
Proceed to Settings > Branches to start the merging process. We'll check for any conflicts beforehand:
A conflict means that a certain element (for example, a translation key) was modified in both branches and therefore you have to decide which version of this element should be kept.
You can resolve conflicts in favor of one of the branches by clicking Resolve all using... or by clicking Show next to the conflict (check the screenshot above). When the Show button is clicked, you'll see a similar interface:
Now simply choose what version to preserve.
It is vital to understand how the merging process works, so let's take a look at some examples.
Suppose you have a branch named master. Then you create a new branch named develop which is based on master. Initially, these two branches are equal (meaning that the translation data, language settings, and other content is identical in both branches). Let's also suppose we have a key called
welcome with the English translation "Welcome to the app!".
Scenario #1: perform changes in develop only and merge into master
In develop branch we change "Welcome to the app!" to "Welcome to our application!". The master branch has no changes. Then we merge develop into master. As a result, the master branch will now also contain the "Welcome to our application!" translation for the
Scenario #2: perform changes in master only and merge into develop
This scenario is very similar to the first one. If you change the translation for the
welcome key to "Welcome to our application!" in master and then merge this branch into develop, then this new version will appear in the develop branch as well.
Scenario #3: change the same translation both in master and develop and perform merge
Now suppose we have modified the English translation for our
welcome key in both branches:
master — "Welcome to our application!"
develop — "Welcome onboard!"
In this case if you try to merge develop into master, or master into develop, a conflict will be detected. You will need to manually pick the version to keep. The other version will be erased during the merge.
Scenario #4: perform changes in develop and merge master into develop
This scenario is less obvious. Suppose you change the
welcome translation to "Welcome to our application!" in the develop branch. The master branch, however, has no changes and contains the old translation value "Welcome to the app!". If you merge master into develop, then the "Welcome to our application!" translation will be used as a result.
Effectively, that means you cannot "restore" translations that were modified in the develop using the old master versions. Why? As long as the translation in develop was modified since the branch creation, while the translation in master was left intact, we consider the develop version to be the newest. The older version cannot overwrite the newer one, therefore in this scenario you'll get "Welcome to our application!" translation as a result. If, however, you change the same translation in both master and develop then there will be a conflict as described in scenario #3.
Scenario #5: delete the
welcome key in master, update the same key in develop, and then perform merge
In this case the result will depend on the target and the source branches that you choose:
If you choose to merge develop into master, then you'll see a conflict saying that the
welcomekey was removed in one branch and updated in another one.
If you choose to merge master into develop, then no conflicts will be detected and as a result the
welcomekey will be left intact (it won't be removed).
Scenario #6: delete the
welcome key in develop and merge into master
Suppose, we delete the
welcome key in the develop branch. The master branch has no changes. Then we merge develop into master. As a result, the master branch will now also get the changes for the
welcome key, which means that the
welcome key gets deleted on master.
How branching affects your project
Once you enable branching, the current version of the project becomes the master (main) branch.
Different areas/functions of the project are now either global or branch-specific:
Automations work only for the master branch
Project settings are global.
Snapshots are currently created only for the master branch. This applies to all automatic snapshots (i.e. when applying bulk actions).
The contributor list is global.
Contributors have access to all branches and you cannot make certain branches "protected" (available only to project admins or certain contributors).
Language access and roles are shared across all branches.
Languages are branch-specific.
There could be merge conflicts in languages, which you'll need to resolve at the merge phase.
Changing a language (in the language settings) is disabled in branching mode.
Keys are branch-specific.
There could be merge conflicts which you'll need to resolve at the merge phase.
When merging, the new key data overwrites the existing key data in the target branch (check the examples above).
Key tags do not create conflicts, they are merged.
Key comments are branch-specific.
Key comments are not merged when merging branches. If you merge two branches, only the comments from the target branch will be preserved.
Translations are branch-specific.
There could be merge conflicts which you'll need to resolve at the merge phase.
Reviewed and Unverified statuses may also create conflicts.
Upon merge, the source translation overwrites the target (existing) data including Reviewed, Unverified and Custom translation statuses (if enabled).
Spelling exceptions apply to all branches.
Key references are branch-specific.
Cross branching key references are not supported. If you reference some other project key then it will default to master.
Glossary is global.
Term extraction works only from master.
Translation history is branch-specific.
Screenshot storage is global, however key linking is branch-specific. If you delete a screenshot it gets deleted from all branches.
Uploads are branch-specific.
Downloads are branch-specific.
Strings included from other projects are based on the master if branching is enabled in the chosen project.
Activity is branch-specific.
Certain events appear only on master if it's a global activity (for example, adding a contributor).
Branch activity is lost after the branch is deleted (does not apply to audit logs).
Tasks are branch-specific.
Orders are branch-specific.
Statistics is branch-specific.
API requests are branch-specific.
Branching is only available in API 2.0.
Apps (previously known as "integrations") are either global or branch-specific.
GitHub, GitLab, Bitbucket, and other Git-related integrations are branch-specific.
Webhook, Asana, E-mail, Jira, Slack, Trello can be either global (any branch) or per branch.
All other integrations are for the master branch only.
Offline translations are branch-specific.
If an XLIFF file was downloaded from the
branch_a, it can only be uploaded back to the
branch_a, but not to the
branch_b. Similarly, a file downloaded from the
branch_bcan only be uploaded to the