Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does smart merge do in Android Studio?

In Android studio there are options at the bottom right corner to handle branches. In Merge option when I merge another remote or local branch, it shows me options like Force merge and smart merge.

What exactly they do?

When merging with local/remote branches?

Git branches

like image 944
TapanHP Avatar asked Jul 30 '16 03:07

TapanHP


2 Answers

its similar to Smart Checkout. Android Studio will stash local changes, check out the selected branch, and then unstash the changes. If a conflict occurs during the unstash operation, you will be prompted to merge the changes.

like image 127
Audakel Avatar answered Oct 04 '22 20:10

Audakel


Smart merge executes the following commands:

  1. git stash save "Uncommitted changes before Update at <MM/DD/YY>, <HH:MM>"
  2. git merge <remote>
  3. git stash pop (if merge successful)

If the merge is unsuccessful and you abort or discard changes, you'll need to run git stash pop yourself to get back your changes.

You can see the exact commands being executed by examining the Version Control context in Android Studio, in the Console tab:

Log of Git commands in Android Studio

like image 42
Elliott Beach Avatar answered Oct 04 '22 19:10

Elliott Beach