[Nexus 6 Q&A, Help & Troubleshooting] scryan:
Android documentation is kinda lacking :(

Its not terrible... Its just not entirely coherent, well organized or complete. A lot of poking around and learn by doing, patching together threads that document how things work ect...

Here is my suggestion:

Follow the second link posted by simms22 above, this one here: http://xdaforums.com/nexus-6/general/noob-read-adb-fastboot-how-help-t3006500

Go here: https://developers.google.com/android/nexus/images?hl=en

And download the latest image for your phone (shamu, the images at the bottom of the list are most recent. All carriers currently use same build, unless your on tmobile or Fi)

Use some kind of unzipping program (not sure if winrar can do .tgz, if not just google "Windows .tgz") to decompress the image you download. This will have a few .img files in it and a .zip Unzip the .zip for the rest of the partition images for the phone.

With these you can use fastboot to re-format partition to stock.

Here is an older guide, while devices may vary a little... and things have changed since 2011, were still mostly talking about system, boot, recovery, data....

http://www.addictivetips.com/mobile...plained-boot-system-recovery-data-cache-misc/

I would say read through the above guides thoroughly, then manually update your phone to stock.

You will notice the stock flash-all script will

fastboot flash bootloader bootloader-shamu-moto-apq8084-71.10.img
fastboot reboot-bootloader
ping -n 5 127.0.0.1 >nul
fastboot flash radio radio-shamu-d4.0-9625-02.101.img
fastboot reboot-bootloader
ping -n 5 127.0.0.1 >nul
fastboot -w update image-shamu-lmy48m.zip

You probably don't want to do all this... You will notice the last command I showed is fastboot -w update image-shamu-lmy48m.zip (assuming you downloaded the lmy48m image)

We already unzipped this, so rather then flash it in bulk (flashing userdata.img will wipe device) lets flash everything but leave data in place.

So get fastboot working, go to bootloader, and as the script does

With fastboot:

Flash the bootloader

then use fastboot to reboot, to the bootloader

flash the radio

then use fastboot to reboot to the bootloader

then fasboot flash system, recovery, boot and cache images, skipping userdata to avoid wiping the sd card.

At this point reboot. It may take a while for the first boot as android sets itself up and optimizing applications. If things appear to be hung give it 10 minutes before forcing a reboot checking your images and trying again. Pay attention to the output of the commands and make sure there are no errors. If there are read them, and google them.

Now you should be able to boot, and you will be fully stock. This is what it takes to recover from almost any situation. Often you can just flash system to update. Boot will overwrite your kernel, so it is often skipped when custom kernels are used... particularly when not encrypted.

Now find the website for twrp and find the image for your device, then go back to bootloader mode and flash recovery, after flashing reboot directly to recovery.

Also find chainfire's website with the recovery flashable supersu (should be a .zip)

Make sure the supersu install zip is on your phone, and the recovery is on your computer.

Reboot to bootloader and fastboot flash twrp to your recovery partition, then immediately reboot to recovery mode to finish the install.

In recovery make a backup of your working stock system.

After that install supersu

Reboot, and you should be stock and rooted with a backup of your completely stock system.

From here if your want to install a rom reboot to recovery, wipe caches, system and data. On future upgrades backup first, and try only wiping system and caches, then flash the new version of the rom and you wont have to set anything back up. You will have to reinstall xposed if your use it, as well as supersu if your rom does not include it for some reason.

If you do all that, read those guides to the point where you understand each step, and read the thread or at least the last hand full of pages of any rom or utility that you use... Things should work pretty good.