First of all

  1. Your Moto G must be charged to atleast 60% ( I suggest a 100%)
  2. Backup all data on your Moto G (since unlocking will erase everything on the phone)
  3. Install the Android SDK on your PC (Download/Installation link)
  4. Install the latest Motorola drivers for your PC (Download/Installation link)
  5. Enable USB Debugging on your Moto G.

Unlock Bootloader

So, you’ve got it all installed, lets get started.

Step1: The first step is to switch off the Moto G and bring it onto the fastboot mode by pressing the “Power” button and “Volume Down” button together for 2-3 seconds and letting them go.

Step2: Next connect it to your PC using a USB cable. On the PC, head on the following folder:

“Android-SDK” and then onto the “platform-tools” folder.

Step3: Once there, hold down the “Shift” button on the keyboard and “Right Click” on an empty area in the folder. Out of the options given, select “Open Command Window Here”

This will open up a black command window with the path to this folder already visible. Here type:

fastboot oem get_unlock_data

and hit Enter. Copy the data that you get and head on to this website and enter it in the space provided at Step6.

Step4: Next, read and agree to the Legal Terms and Agreement and select “I agree” and hit Submit. After you submit this information, you would shortly receive an email from Motorola that will contain the unlock code for your Moto G.

Step5: Copy that code and head back onto the black command window and type:

fastboot oem unlock UNLOCK CODE

and hit Enter. This will take a few seconds and your Moto G would now have its bootloader unlocked. Please note, rooting/unlocking bootloader voids your warranty, so please follow at your own risk.

 After get the Unique code

1. Turn off your device.

2. Start your device in fastboot mode. To do this on most Motorola devices, push and hold the power and volume down at the same time, release the power button then release volume down. The device will now power up in fastboot mode.

3. Connect the device to the computer with a USB cable. You’ll get a confirmation message on the device to indicate that it’s connected.

4. Open a command window or terminal on your computer.

5. Change the field to show the path to the tools folder within the Android SDK folder.

6. Verify that the desktop and device are connected by entering the following in the command field:
$ fastboot devices
You should see that your device is connected.

7. To unlock the bootloader, enter the following in the command line:
$ fastboot oem unlock <Replace UNIQUE_KEY here>
The UNIQUE_KEY is the code you received in the email. It is case-sensitive.

8. If the line was entered correctly, you will see a message confirming that your device was unlocked.

View the video here:

Root the device