From the main menu, choose VCS | Mercurial | Push. The Push Commits dialog opens showing all Mercurial repositories (for multi-repository projects) and listing all commits made in the current branch in each repository since the last push.
If you have a project that uses multiple repositories that are not controlled synchronously, only the current repository is selected by default. For details on how to enable synchronous repositories control refer to Version Control Settings: Mercurial.
If necessary, you can modify the path to the remote repository by clicking it. The label turns into a text field where you can type the new path or invoke completion by pressing Ctrl+Space.
If there are no remotes in the repository, the Define remote link appears. Click this link and specify the remote name and URL in the dialog that opens.
If you want to preview changes before pushing them, select the required commit. The right-hand pane shows the changes included in the selected commit. You can use the toolbar buttons to examine the commit details.
note
If the author of a commit is different from the current user, this commit is marked with an asterisk.
If you want to push active bookmarks with your commits (they are not sent to the remote repositories by default), select the Export Active Bookmarks option.
Click the Push button when ready and select which operation you want to perform from the drop-down menu: push or push --force.
tip
You can also switch to the editing mode by pressing Enter or F2 for the selected element.
tip
You can press Ctrl+Q for the selected commit to display extra info, such as the commit author, time, hash and the commit message.
tip
If you select an entire repository, all files from all commits will be listed in the right pane.
If the same file was modified within several commits, it will only be listed once if you select these commits or the entire repository, and if you invoke the Differences Viewer for this file, all changes will be zipped together.
Using force push
When you run push, Mercurial will refuse to complete the operation if the remote repository has changes that you are missing and that you are going to overwrite with your local copy of the repository. Normally, you need to perform pull to synchronize with the remote before you update it with your changes.
The --force push command disables this check and lets you overwrite the remote repository, thus erasing its history and causing data loss.
A possible situation when you may still need to perform --force push is when you rebase a pushed branch and then want to push it to the remote server. In this case, when you try to push, Mercurial will reject your changes because the remote ref is not an ancestor of the local ref. If you perform pull in this situation, you will end up with two copies of the branch which you then need to merge.
warning
Rebasing a pushed branch and modifying its history should be avoided unless absolutely necessary (for example, if you've accidentally pushed some sensitive data).
warning
Using the --force will lead to all new heads being pushed on all branches, which is likely to cause confusion for your team.
If you decide to force push the rebased branch and you are working in a team, make sure that:
Nobody has pulled your branch and done some local changes to it
All pending changes have been committed and pushed
Our website uses some cookies and records your IP address for the purposes of accessibility, security, and managing your access to the telecommunication network. You can disable data collection and cookies by changing your browser settings, but it may affect how this website functions. Learn more.
With your consent, JetBrains may also use cookies and your IP address to collect individual statistics and provide you with personalized offers and ads subject to the Privacy Notice and the Terms of Use. JetBrains may use third-party services for this purpose. You can adjust or withdraw your consent at any time by visiting the Opt-Out page.