How to edit an incorrect commit message in Git [#git]

This was a new one on me… and I needed it recently. I accidentally committed a change with a totally nonsensical message since I accidentally copy-and-pasted some code into the message field of my commit, which automatically commenced.

Thankfully, there is a way to update it before you push (that seems to be the key to success here… don’t push it after you do the commit with the bogus message):

version control – How do I edit an incorrect commit message in Git? – Stack Overflow

git commit --amend -m "New commit message"

I’m just relieved that this can be done… and a little surprised — given how grumpy and curmudgeonly Git feels sometimes.

How to Format JSON in TextWrangler [#iosdev, #json, #webdev]

If you’re a TextWrangler user and you wanted to be able to format a block of JSON, you can do it yourself by following the instructions at Java Dev on Mac OS X: Format JSON in TextWrangler

1. Create text (Python) file called “Format JSON” in the following location:

~/Library/Application Support/TextWrangler/Text Filters/Format

2. Add the following Python code to take care of the formatting:

import fileinput
import json
if __name__ == "__main__":
  text = ''
  for line in fileinput.input():
    text = text + ' ' + line.strip()
  jsonObj = json.loads(text)
  print json.dumps(jsonObj, sort_keys=True, indent=2)

One thing that tripped me up is that you need to select a block of text before running the macro. Otherwise it works great.

Thanks for the tip!

I’m not sure if it was due to installing newer versions of Xcode or Mountain Lion, but I noticed that I was getting an error when attempting to run the script.

Evidently the first line:


Might need to be:


…or maybe you could create a symbolic link as well, but for me, since I’m not a Python guru, modifying the script was the easiest way to fix the problem.

How to Know When Apple Finally Gets iCloud Right [#iosdev #icloud]

Gus Mueller of Flying Meat Software offers his opinions on what Apple must do to get iCloud right for developers:

The Shape of Everything: How to Know When Apple Finally Gets iCloud Right

But how are we going to know Apple has finally fixed iCloud syncing for developers and is really serious this time? And I’m not just talking about Core Data syncing, I’m also talking about the APIs developers are given to push document data back and forth. The broken stuff, the things developers laugh at Apple about and have given up on.