The licence applies when you publish the work. So if you publish after the commit then it covers all of the commits.
If you publish before you add the licence, then there is no licence for anyone to use your copywrited work until you publish a version under a licence of some kind.
The problem you are thinking of occurs when a project is published under one licence and then changes to another.
In that case people who have downloaded the work under the old licence are still on that licence. With open source licences this often means they can republish the work under the same licence.