+12
Completed

Stash should be saved prior to merging into branch with local changes, to allow for safely aborting the merge

Christopher Kline 3 years ago updated by Marc Strapetz 2 years ago 3

This has bitten me a couple times now.


If you have local changes (unstaged) and you right-click on a different branch and choose "merge" and then select "create merge commit", SmartGit does not create a stash prior to initiating the merge.


If the merge goes bad, and you abort it, you will lose all of your local changes when SmartGit aborts the merge.


If SmartGit first created a stash (as it does for pull operations), this loss of work could be avoided by recovering from the stash.


Repro:

  1. Make some changes locally in master but do not stage or commit them
  2. Initiate a merge into master from another branch (using the "create merge commit" dialog option), such that conflicts are created during the merge
  3. Click the "Merge" button on SmartGit to abort the merge
  4. When the "Do you want to reset your working tree?" dialog appears, press "abort merge"

Result: after the abort completes, the local workspace is clean and all local changes have been erased.



Other notes:
  • In step (3), it would be helpful if the "Merge" button would change to "Abort Merge" in this situation, for discoverability
  • In step (4), this dialog is a little confusing. It asks if you want to reset your working tree, but the buttons say "abort merge" and "cancel". For clarity, I recommend A) changing "Do you want to reset your working tree?" to "Do you want to abort the merge and reset your working tree?", B) changing "abort merge" to say "Yes, abort merge"

I know this isn't the highest-voted request, but this just bit me yet again today. Any possibility of getting it into an upcoming build?

Completed

Since 18.1 preview 2, SmartGit is using "git merge --abort" now which should resolve this problem.