Marc DiNino
Marc DiNino

Reputation: 812

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?

Upvotes: 13

Views: 19099

Answers (6)

Oumaima Makhlouk
Oumaima Makhlouk

Reputation: 624

  1. Go to git

enter image description here

  1. Select the commits you want to squash and then right click and click on squash commits enter image description here

Upvotes: 0

sadat
sadat

Reputation: 4342

You can open the commits from bottom of Android Studio

enter image description here

And select the commits you want to squash and right click , you will see the context menu

enter image description here

Select Squash Commit and add your commit message.

Upvotes: 0

Prashant naik
Prashant naik

Reputation: 697

In addition to the answer mentioned by @Crain, you can select multiple commits and then there is an option to squash. This is for Android studio chipmunk.

squash commits

Upvotes: 2

hushed_voice
hushed_voice

Reputation: 3608

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.

Upvotes: 3

Crain
Crain

Reputation: 244

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

Upvotes: 13

Vampire
Vampire

Reputation: 38639

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.

Upvotes: 6

Related Questions