by jackowayed · 17y ago · 0 comments
That's true w/in your scenario but a little misleading because it's not always true.
If you don't use the experimental branch, you can add and commit pieces of files, yet the tests will run not on what's committed but what's in your directory. So if you had
print password_to_the_admin_interface
for some reason, and then you comment that out/delete it and forget to add that part of the file, you test it and see that it's not printing the pass, but then you push and deploy and bad shit goes down.Just clarifying so no one's like "I can't push code I didn't test! Git is so safe!" and then allows disaster to occur.
I'm guessing that you could fiddle with git's hooks to discourage or even prevent this problem, if you wanted to. For example, you could refuse to allow "git push" to be run from within a repository that contains uncommitted changes, and also include a requirement that your tests pass before the push commences.
Usually it's when I do one thing, then start another, then realize that I really should push the old thing first.
So I add the old thing I did, commit, test (when I test. sometimes I'm bad and don't have real tests.) and push, leaving this half-finished method uncommitted.
I guess I really should just git stash.
C does not have nearly as many useful things built in as git.