Automatic versioning of Android build using git describe with Gradle

Put the following in your build.gradle file for the project. There’s no need to modify the manifest directly: Google provided the necessary hooks into their configuration. def getVersionCode = { -> try { def code = new ByteArrayOutputStream() exec { commandLine ‘git’, ‘tag’, ‘–list’ standardOutput = code } return code.toString().split(“\n”).size() } catch (ignored) { return … Read more

Heroku – Display hash of current commit in browser

It’s now possible to try the Heroku feature Roberto wrote about in his answer, without contacting Heroku. It’s called Heroku Labs: Dyno Metadata and you can enable it by heroku labs:enable runtime-dyno-metadata -a <app name> and then the information is available (on the next deploy) as environment variables: ~ $ env HEROKU_APP_ID: 9daa2797-e49b-4624-932f-ec3f9688e3da HEROKU_APP_NAME: example-app … Read more

automatically stash save/pop changes on git rebase?

Edit: As of Git version 1.8.4, but with an important side bug fixed in Git version 2.0.1, git rebase now has –autostash. You can configure git rebase to use –autostash by default as well, with git config –global rebase.autoStash true. Please note the following sentence from the documentation: However, use with care: the final stash … Read more

Remove a directory permanently from git

The ProGit book has an interesting section on Removing Object. It does end with this: Your history no longer contains a reference to that file. However, your reflog and a new set of refs that Git added when you did the filter-branch under .git/refs/original still do, so you have to remove them and then repack … Read more