19 July 2012

Save Logcat contents to file

Note to self: to save the contents of Logcat to a text file:
  1. Navigate to the SDK installation directory.
  2. Go to the /platform-tools folder.
  3. adb logcat -d > my_logcat_dump.txt
If there is more than one device connected to adb, specify which device's log to dump:
adb -s emulator-5558 logcat -d > my_logcat_dump.txt

05 July 2012

Cloning a remote branch in git

My current project at work uses git, and I have always been a CVS/SVN baby so I'm still trying to find my way around it. Today I wanted to clone a remote branch to my local computer. This remote branch also has submodules, so I want to get those too.

This assumes that you use Git Bash. First, navigate to the folder in you local computer where you want git to clone the remote branch. Once there, we can start cloning the repo. The following steps do the dirty work:
$ git init
$ git fetch <git url> <branch name>:refs/remotes/origin/<branch name>
$ git checkout -b <branch name> origin/<branch name>

This retrieves the contents of the remote branch and copies it to our local computer in a local branch (confused yet?). To update our copy of the submodules, the following commands should work:
$ git submodule init
$ git submodule update