+2

Improve stashing on fast-forward merge to the same commit

Gxost 3 years ago 0

I often have the following scenario:

  1. Current branch with non-clean working tree/index.
  2. A branch I want to switch to with origin head pointing to the same commit as current branch and with local head pointing to some older commit.
  3. When I switch to the target branch SmartGit asks for fast-forward merge and after accept I get lots of conflicts just because stashed changes are unstashed too early.

    I suggest the following fast-forward merge for such scenario:

    1. Stash changes.
    2. Switch to the target branch and perform fast-forward merge.
    3. Unstash changes.

    In this case because stashed changes are applied to the same commit no conflicts occur.