Apologies if this seems redundant as I know there are fair amount of questions regarding Merge vs Rebase, but there doesn\'t seem to be any that throw in \'Branch Default\'
I couldn't find the answer to this question (i.e. the work-flow) in any of Google's documents... so here's my practical experience using Android Studio and Git completely from a UI.
(I vomit at the thought of switching between command line and IDE - it means the IDE is lacking!)
WARNING
The manual merge "Merge Revisions" UI is TERRIBLE. Once you try it, you'll see what I mean. Good luck trying to get "Synchronize Scrolling" to actually work. I sincerely hope this UI is addressed within the first few weeks of 2015.
According to documentation:
Merge: select this option to perform merge during the update. This is equivalent to running
git fetch
and thengit merge
, orgit pull --no-rebase
.
Rebase: select this option to perform rebase during the update. This is equivalent to runninggit fetch
and thengit rebase
, or `git pull --rebase (all local commits will be put on top of the updated upstream head).
Branch Default: select this option if you want to apply different update strategies for different branches. You can specify the default update type for each branch in thebranch.<name>
section of the.git/config
configuration file.
Merge vs Rebase
Read more here
For those who are looking for rebase
in Android Studio.
VCS > Git > Rebase.
Then click "Rebase", "Start Rebasing", "Merge". To simplify a process click "All" to resolve non-conflicting changes.
There may be conflicting changes, resolve them until you get a message:
If you encounter these conflicts, click left or right arrow to accept the most suitable:
Click a cross over unneccessary change to ingnore or an arrow to accept:
If you accept both changes, you can also edit the resulting code, for instance, add missing }
in methods.
Do this until all conflicts get resolved:
Click "Apply". When all files inside one commit will be up-to-date, click "Continue rebasing" to move to the next commit.
Stashing
The key here is that you have uncommitted work that you want to save. Before trying to merge anything in, you should stash your changes to save your uncommitted changes and clean your working directory.
Run git stash
to stash your changes. You should then be able to pull the changes without any issues.
After you have successfully pulled, you can do a git stash apply
to re-apply the changes you had made prior to the pull.
Merging and rebasing
Stashing your changes only works if you only have uncommitted changes. If at some point you committed but didn't push you will need to either rebase or merge.
This StackOverflow post has some great information on the differences.
In general, merging is easier, but some believe that it "pollutes" the git history with merge commits.
Rebasing requires additional work, but since you don't have a merge commit it will essentially make the merge invisible.
Again, in your case you shouldn't need to merge or rebase. Simply stash, pull, then apply the stash and it should all be good.
Update Git project with android studio terminal
This is what I was wanting to find the answer from your post. So that's why I writing this answer.
According to the IntelliJ IDEA documentation:
git fetch ; git merge
or git pull --no-rebase
.git fetch ; git rebase
or git pull --rebase
.branch.<name>
section of the .git/config
configuration file.In this area, specify the method to save your changes while cleaning your working tree before update. The changes will be restored after the update is completed. The available options are: