We don't really need to restore the timestamp, there is a better trick to support build tool: replace
git checkout new_branch
with
git rebase origin/main new_branch
With that, you always works on the main branch with only simple changes.