r/programmerchat • • May 23 '15

Pre-commit nervousness - does anyone else have it or am I alone?

When I prepare a commit, I usually double and triple check the changes I'm about to push. I go through all changed files and lines and verify that I indeed am only pushing those changes which I want to, even when I know that there are no other changes in my code than those and/or that I already went over that stuff.

The more complex the pending commit, the more "nervous" and detailed in my sanity checking I am. Doesn't take a lot of time, but I'd feel wrong not doing it.

I rarely saw my colleagues doing that, so I was wondering how common that is or if should start to worry ;)

edit: Let me clarify that it is not that I sit there shaking with fear of committing, it's more the need to do a final sanity check. It's not even an uncomfortable feeling, for me it just belongs to the whole part of developing. I was just wondering if other people were experiencing that too. "nervous" might have been too strong a word.

25 Upvotes

35 comments sorted by

View all comments

4

u/[deleted] May 23 '15
git commit --amend

I also was terrified of official commits, because I always forget at least one little thing. Several times in a row. But with amend, I can sweep those mistakes under the rug!

3

u/foosel May 23 '15

I know of amending, I still do it (also when amending).

It's less a case of nervous nail biting or a feeling of terror or something (although I do become a special kind of anxious on my very first commit to each new project) but more of... I don't know, maybe a last critical look although I know everything is alright? Hard to describe the motivation behind it really.

"Nervous" might be too strong a word in fact.

3

u/therealfakemoot May 24 '15

You might feel better if you practice with git rebase -i. Having the power to freely rearrange, modify, or even drop commits entirely and rewrite the history, you can make as many crummy commits as you want and then when you're ready to merge into master or push to the remote, you can clean the history up.

2

u/jetpacmonkey May 23 '15

Although that doesn't help you too much if you've already pushed to origin.

2

u/Ghopper21 May 23 '15
git push --force

That's when I get nervous.

2

u/Xelank May 23 '15

force with lease is your friend :-)

1

u/Ghopper21 May 24 '15

Ah... nice. Thanks. TIL there's a better way. I agree with the blogger that some form of this should become default behavior with --force.

2

u/Xelank May 24 '15

I have never used it in practise, but it's really useful to know. Perks of being a long time proggit lurker :-)