git commit —idiot
I do this way too often. Our folder structure for projects is something like:
Where www.primary-domain-name.com/ is the containing folder which holds all files relevant to the build (templates, media, db, etc) and /project-name/ is the Django project folder. Our git repo is obviously in the root folder www.primary-domain-name.com/.git
In order to work with Django I need to be in its project folder. This is where I run startapp, runserver, etc. So I spend most of my time in Terminal in this folder. Which also means I forget and run git from this folder as well.
Ok so it there doesn’t seem to be a problem. I had a look to see what changes I had made, added all files to my commit (git add .) and then committed them. Didn’t I? Well no actually I didn’t.
Huh? None of those files got added to the commit? But I did a “git add .”!? Well the “add .” basically means add all files in the current folder and any sub-folders, but notice the “../” in the status message above, those files/folders are siblings of the folder I am executing commands in, not children. Fuck.
But it’s ok, we can fix it without too much trouble and without mucking up our logs.
Up a folder, add all files (for real this time!), and then amend our last commit. I do this so often I should have an alias for it “git commit —idiot”