Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Squash Git Branch Commits in Android Studio

I prefer to use the Android Studio VCS UI as much as possible. Currently when I have to squash commits, I have to go through the command line and even open up a command line editor (with the git rebase -i command).

I was hoping that there was a clean way to do this through a Visual Studio UI. Is there one?

like image 843
Marc DiNino Avatar asked May 09 '16 17:05

Marc DiNino


3 Answers

I prefer using the UI too I have found that squash commits can be made in "Rebasing commits" window: "Version Control" -> "Log" -> "Select base commit" -> "Context menu" -> "Interactively Rebase From Here..."

Context menu of a commit

like image 154
Crain Avatar answered Oct 19 '22 23:10

Crain


Go to VCS -> Git -> Rebase..., there you can amongst other things check 'Interactive'. At least in the latest IntelliJ IDEA version it is like that and AS is based on IJ. If your AS version is based off an older IJ version, it might be different if possible at all.

Btw. you don't have to use a command line editor when doing interactive rebase from command line. I e. g. have an alias that sets my Git editor to jEdit, so I can decide on each command that needs an editor whether I want to use the command line editor vim, or the GUI tool jEdit. But it can be configured persistently without an alias too of course.

like image 28
Vampire Avatar answered Oct 19 '22 22:10

Vampire


I am adding the whole process for squashing commit here, just in case.

  • Click on the version control on the bottom toolbar(cmd+9)
  • Select log tab
  • Select the base commit and right click on it.
  • Select Interactively Rebase from here as shown by @Crain
  • In the next window, select squash from the drop down for the commits you want to squash.
like image 30
hushed_voice Avatar answered Oct 20 '22 00:10

hushed_voice