31

I'm using git plugin with android studio. My problem is when I submit a change list(public commit) but my comment in change list was wrong/missing and I want to change it.

QUESTION :

Is there any way to edit information of my public committed change list by git add on in AndroidStudio.

I'm using MacOSX.

Zoe
  • 27,060
  • 21
  • 118
  • 148
ThaiPD
  • 3,503
  • 3
  • 30
  • 48

5 Answers5

68

For Android Studio 3.1.1

  1. Click Version Control tool window (at the bottom of the window).
  2. Click Log tab. You will see a list of your commits, with their comments.
  3. Right click the commit you want to change its comment, then click Reword.
Ace
  • 2,108
  • 22
  • 29
Azfar
  • 681
  • 5
  • 5
9

You can't change the last commit comment from the editor. You can amend the last commit, so add an comment to the last commit, but you will also have to commit a change, to do so :

When committing, you have a checkbox Amend commit, select it. Your commit will be amend to the previous one. See this thread

But if you use the commandline, you might be able to have more options to do what you want, from this thread :

git commit --amend

Will open your editor, allowing you to change the commit message of the most recent commit.

Community
  • 1
  • 1
flafoux
  • 2,080
  • 1
  • 12
  • 13
  • 1
    This answer only provides half of the solution. It should also include how to save the new commit message. Always state the "obvious" in your answers. Assume the reader is a dummy, like me in this case. – Rod M Apr 19 '18 at 22:40
  • @RodrigoMesquita, so how did you save the commit message? I have the same problem as yours lol – Agent 0 Jun 09 '18 at 21:51
  • @RodrigoMesquita I see, yeah I used this. Is there any way to save the commit message with Terminal commands instead? – Agent 0 Jun 13 '18 at 02:28
  • @Kourosh, yes there is. But the whole point of the new version of Android Studio is to get away from the terminal commands. – Rod M Jun 14 '18 at 13:39
  • I see, sometimes I prefer old school command line, but better to learn other ways too. Thanks for your feedback! – Agent 0 Jun 20 '18 at 00:02
7

For Android Version 4.0.1

Step-1 Click the Version Control from Bottom of the Android Studio window OR shortcut key like Ctrl+9

enter image description here

Step-2 It opens the Version Control Window

enter image description here

Step-3 Right-click commit message and click the Edit Commit Message... OR Press F2

enter image description here

Step-4 It showing Edit Commit Message pop-up and you will edit your new commit message and press OK button.

enter image description here

Step-5 After that it showing edited commit message in Version Control Log list.

enter image description here

Pratik Dodiya
  • 2,337
  • 1
  • 19
  • 12
0

For Android Studio 4.1.1

  1. Click Version Git (at the bottom of the window).

  2. Click Log all tab. You will see a list of your commits, with their messages.

  3. Right click the commit you want to edit, then click on Edit Commit Message.

iamkdblue
  • 3,448
  • 2
  • 25
  • 43
0

I just had to deal with several wrong commit messages in a row, all of them already pushed. I followed Pratik Dodiya comment and used Edit Commit Message on each of the wrong commit messages, then I just did force push. Worked like a charm.

Ahmed Ahmedov
  • 592
  • 12
  • 29