Some clues are available in this video: https://www.youtube.com/watch?v=4XpnKHJAok8 (Tech Talk: Linus Torvalds on git). There's nothing conclusive about the length of the pondering, but he does say the writing itself took two weeks:
"I decided I can write something better than anything out there in two weeks. And I was right." [1]