How to use git to track your changes in smali file?

Altering smali file may be simple but it’s hard to remember those changes. Because, we are not familiar with the instructions used in dex bytecode format. You need to remember either line number or method name whenever you modify the code. In case you are working on obfuscated app, it’s very difficult to find the modded method because there could be more than ten methods with the same name but different parameters. Just imagine how challenging it would be if you happen to work on obfuscated APK which has more than ten thousand decompiled classes.

Comment Section

You could use comments enclosing the modified or newly added lines in the file. You can use the same comment in search tool to find the modified location again. Though it helps us, it’s a tedious extra work we have to do even for a simple character change.

Using Git Tool

Yes. We are going to use git for tracking bytecode changes. You might be familiar with git tool. No problem if not. You can simply download and install the GUI client from here. You are all set once you have Git GUI installed on your computer. There is no need for remote repository as long as you work remains only on your own machine.

Let’s see how to prepare your project folder for Git and use it for tracking the changes.

Git Bash

Open Git Bash console from the folder where you have your decompiled APK files.

git init

Make it as Git repository using the command git init as given below.

siva@my-computer MINGW64 /e/AppModder/QuickChat
$ git init
Initialized empty Git repository in E:/AppModder/QuickChat/.git/

git add –all

Add the APK files into Git repository using the command git add –all as shown below.

siva@my-computer MINGW64 /e/AppModder/QuickChat
$ git add –all
warning: LF will be replaced by CRLF in apktool.yml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in assets/crashlytics-build.properties.


siva@my-computer MINGW64 /e/AppModder/QuickChat

git commit -m “pristine copy”

Commit the files using the git commit command. You can rollback to this version anytime when needed.

siva@my-computer MINGW64 /e/AppModder/QuickChat
$ git commit -m “pristine copy”
warning: LF will be replaced by CRLF in apktool.yml.
create mode 100644 smali/DN.smali
create mode 100644 smali/DO.smali
create mode 100644 smali/DP.smali


create mode 100644 smali/DQ.smali
create mode 100644 smali/DR.smali
create mode 100644 smali/DS.smali
siva@my-computer MINGW64 /e/AppModder/QuickChat

Verify your changes

Whenever you want to see the changes, open Git GUI from your decompiled folder. It will show all the changes that so far you have done since the last commit.

Now it’s time to review your changes before making the build. You can also revert any changes using Revert Changes option as show below.

If you want to remove Git tracking, you can simply delete .git folder from your project. Make sure you enabled hidden file view.

Leave a Reply

Your email address will not be published. Required fields are marked *