Git branch from a specific commit

Yet more git syntax I keep forgetting. To branch and create a new line of development from a specific commit, do the following:

git branch newbranchname a9c146a09505837ec03b

Add the -b switch to immediately checkout after branching.

Since the commit will likley be behind, use --force when pushing to tell git to ignore future commits from the original branch and start a new fork.

Couldn’t reserve space for cygwin’s heap, Win32 error 0

Cygwin and Windows git stopped playing nicely together after a recent Windows update. There’s a variety of recommendations for how to fix this this on StackOverflow and elsewhere, but this post actually makes the most sense. In a nutshell, msys-1.0.dll (installed into your Program Files\Git\bin directory) is not built to be position independent. Use the dll rebaser to get it to load at a new address, like so:

$ rebase.exe -b 0x50000000 msys-1.0.dll

And voila, git goodness restored.

“Author” and “Committer” fields in git metadata…

Discovered a nice little git trick today.  I haven’t seen this documented, so I’m not sure if it’s a feature per se, but if you set your user.name via git config like so:

[user]
    name = accountname
    email = email@company.com

and then commit with the --author="Full Name" flag set to another name, this will set git’s commit metadata such that “Author:” is “Full Name” and “Committer:” is “accountname”.

Useful when you want to see the Author in your git logs and the Committer in tools like Hudson or Jenkins.