I have a release-notes.txt file in my git project. I want to remove the old content of the file and put the name of the current branch into the file every time I use "git push". How do I do that?
Thanks in advance.
You really have do not want it, because
You try to perform deploy (sub)task in wrong place and time - information about last "last commit branch" is totally useless inside repo or Working tree and may have sense inside deployed and detached from repo project. But "how to put some data in some file on deploy" is another and different question.
As last resort, if you still want to see this sort of crap in Working Tree, you can use smudge|clean fiters and do not mock logic and common sense. Just to remember - these filters are local tools and cannot be easily distributed as they are not part of the repository.