Yes of course - you can use a Powershell build step for this and pipe the console output to a file, here a practical example:
git rev-parse HEAD > GitRevision.txt
Note that this question/answer is really unrelated to TeamCity - this is just Powershell (you can achieve the same using command line)