Let us suppose I want to make sure that there will be a folder called foo and a file inside it called bar. After I have made sure foo/bar exists I do not intend to version it, therefore I add it to .gitignore.
Bullet-proof approach:
- create foo
- create foo/bar
- commit
- push
- deploy
- add foo to .gitignore
- commit
- push
- deploy
Shorter approach:
- create foo
- create foo/bar
- commit
- add foo/bar to .gitignore
- commit
- push
- deploy
I wonder whether the shorter approach is guaranteed to create the folder, file and to ignore it. I have done a test and the result seemed to confirm my assumption that the shorter approach will add foo/bar at remote locations as well and then stop versioning it. Is this a rule applicable to all versions?