Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight changes in code since last commit in Android Studio

Is there any way I can show changes that I made since the last commit in the code editor?

like image 730
Mahmoud Khateeb Avatar asked Jun 16 '15 15:06

Mahmoud Khateeb


People also ask

How to see Git diff in Android Studio?

Go to “VSC” -> “Git” -> “Branches”, select the master branch and choose “Compare with current”. A popup “Compare feature with master” shows up with all the differences between the two branches, commits to commits, files to files.

How to compare code in Android Studio?

Go to file name in project then press control then select Compare File and select another file you wish to compare. Seperate window will open up showing differences by colour contrast.

How to use VCS in Android Studio?

In Android Studio, go to VCS > Enable Version Control Integration. This option won't be visible if it's integrated with any version control before. Then choose Git as the version control system.

How to commit changes in Android Studio?

Commit these changes to the new branch in Android Studio by right clicking on the project name, hovering over “Git” then selecting “Commit Directory…”. Enter a commit message then select the “Commit” button.


2 Answers

Use the Version Control tab. Under Log, you can select the first two changes, and use CTRL + D or Command + D to produce a diff between the two.

Note that this approach works best with code under source control that's registered with Android Studio. If you're not using any source control, you can still get a partial history of changes by navigating to VCS > Local History > Show Local History and selecting the root directory in your project. Note that this is subject to the Local History log length, which is nominally limited to 1,000 entries.

like image 159
Makoto Avatar answered Sep 21 '22 21:09

Makoto


If you are using subversion Git then :

VCS->Git->Compare with the Same Repository Version

enter image description here

like image 32
Mimu Saha Tishan Avatar answered Sep 18 '22 21:09

Mimu Saha Tishan