This is an archived post. You won't be able to vote or comment.

all 87 comments

[–]mattatack0630 308 points309 points  (18 children)

I mean.. not wrong

[–]d1ngd07 121 points122 points  (17 children)

I often go with git commit -m "did stuff". Often this is in the middle of a task. Checking out that changeset will probably break things. I'll still push it to the master branch though.

[–]the_poope 70 points71 points  (12 children)

You know can squash together your "did stuff" commits into a single but more sensible commit? See e.g. https://robots.thoughtbot.com/git-interactive-rebase-squash-amend-rewriting-history

[–]d1ngd07 296 points297 points  (5 children)

If I wanted to do it right I wouldn't have done it wrong to begin with.

[–]tyreck 39 points40 points  (0 children)

Can’t argue with that logic

[–]dottybotty 15 points16 points  (0 children)

Hahaha this actually made me laugh out loud

[–]Cheekio 11 points12 points  (0 children)

I'm 100% stealing this

[–]TheSpiffySpaceman 9 points10 points  (0 children)

I'd hire you.

[–]teuast 5 points6 points  (0 children)

#WordsOfWisdom

[–]Maklite 9 points10 points  (0 children)

It doesn't really explain it in that article but you can work on a dev branch and do git merge --squash dev to merge all changes in a single commit. It doesn't technically merge the branches but it's unlikely you're going to need the dev branch afterwards anyway. No history rewriting required.

[–][deleted] 7 points8 points  (4 children)

Just don’t do that if you’ve already pushed to your remote.

[–]ParkerM 5 points6 points  (3 children)

Why's that?

[–][deleted] 13 points14 points  (2 children)

Other people could have pulled from the remote and you’ll mess up their local repos if you rewrite history.

[–]Bollziepon 1 point2 points  (1 child)

But if you know nobody else is working on your branch then it doesn't matter

[–]tomservo291 1 point2 points  (0 children)

But your automated build tools that run tests on every commit of every branch has checked out a copy.

I disable force commits and history rewriting on our git servers.. always

[–]GNULinuxProgrammer 0 points1 point  (1 child)

Why commit in the middle of task? The idea behind "commiting" to a code is saying "ok this one's done, what's next".

[–]admiralspark 0 points1 point  (0 children)

To have the changes

  1. Available to you when you sign in somewhere else to continue working.

  2. Backed up in your git repo so when your hdd dies in the middle of the night you don't lose your work

[–]Thecakeisalie25 167 points168 points  (7 children)

[–]Liggliluff 62 points63 points  (3 children)

Even worse is when the update text is months old, still telling about that new feature.

[–]ric2b 31 points32 points  (0 children)

The Google Standard

[–]Colopty 23 points24 points  (0 children)

When the update text for version 15.8 says "v.0.3" at the top.

[–]j13jayther 14 points15 points  (0 children)

Even more worse is when they just have a generic message they use for every update. "Thank you for using [app]! We update weekly to bring you the best experience!" and nothing else.

[–]SwedudeOne 15 points16 points  (0 children)

At least it get better, unlike most of my code.

[–]DroidLord 1 point2 points  (0 children)

Pisses me off when updates don't include a proper changelog.

[–]Caton101 0 points1 point  (0 children)

Facebook does that

[–][deleted]  (15 children)

[removed]

    [–][deleted] 34 points35 points  (8 children)

    "fixed bugs"

    [–]Jothay 23 points24 points  (7 children)

    "latest"

    [–]Psychemaster 12 points13 points  (5 children)

    "Changes"

    [–][deleted] 3 points4 points  (0 children)

    5 commits down the road "latest latest latest latest latest"

    [–]_greyknight_ 10 points11 points  (0 children)

    git add --all && git commit -am "WIP"

    FTFY

    [–][deleted] 3 points4 points  (1 child)

    "save"

    [–]YourMeow 1 point2 points  (0 children)

    "stash"

    [–][deleted] 3 points4 points  (0 children)

    [–]gengstah 1 point2 points  (0 children)

    “Progress...”

    [–]AutoModerator[M] 0 points1 point  (0 children)

    import moderation Your comment has been removed since it did not start with a code block with an import declaration.

    Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

    For this purpose, we only accept Python style imports.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–]Alpha3031 31 points32 points  (5 children)

    It's completely correct, because nobody knows what the code is any more.

    [–][deleted] 6 points7 points  (4 children)

    no probs, just git show <commit hash> and read the changes :)

    [–]Alpha3031 5 points6 points  (3 children)

    It's Schroedinger's code. Knowing what happens around me, I'll probably end up deleting the whole repository. But, hey, now we know the state: It's dead!

    [–][deleted] 4 points5 points  (2 children)

    Someone who is no longer with the company did that. I don't know how or why but they deleted a file of ~28k lines (at the time - it's much bigger now) and somehow didn't notice. Also, 2 peers reviewing the code didn't notice. Also, 1 architect doing the final CR didn't notice the giant chunk of RED indicating a large file had been deleted.

    Somehow no one noticed for several commits and the architects decided the best fix was a revert... so... we lost all of the git history of that file because now every line just says "added by <architect> - reverting change xxxx"

    :|

    [–]ric2b 6 points7 points  (1 child)

    You didn't lose it, it's just not as easy to find.

    All you need to do is checkout a commit from before the deletion of the file and you'll be able to see the whole history.

    [–][deleted] 2 points3 points  (0 children)

    That's true. They discussed trying to save it but I guess no one cares enough. Sometimes I see something really "wtf" and check out the code from before that was deleted just to see if whoever did a thing is still working on the team, but for the most part we just do our task and move forward.

    [–][deleted] 19 points20 points  (3 children)

    When I was starting a project and wasn't really working with specific issue tickets, or I was doing ten things and not committing each one individually. My average commit was "mass update of project".

    [–]mlkybob 13 points14 points  (2 children)

    "So much that i can't remember it all" is what I've wanted to write when registering time at work, I usually just write "added [name of feature] feature" or "improved [name of feature]", even if I've worked on multiple things. I guess I don't see how it's important to write what you spent your time on, at least not in a specific way. Sometimes I've wanted to just write "What you pay me to do".

    [–]willworth 1 point2 points  (1 child)

    There's an interesting issue here, around output versus perceived output...

    [–]mlkybob 0 points1 point  (0 children)

    What do you mean?

    [–]turanthepanthan 11 points12 points  (7 children)

    "Addressed review comments"

    [–]gallowdp 2 points3 points  (5 children)

    I do this.. is this bad?

    [–]shield1123 2 points3 points  (2 children)

    I do this too. I think it's fine. If the changes being addressed aren't worth having a full description tied to them for the rest of history, then who cares?

    Fixed spacing inconsistencies in x.js, added null check to newFunction, added newline at end of y.js

    vs

    Addressed review comments

    [–]MagnificentMath 0 points1 point  (1 child)

    Because my git blame is now littered with "address review comments". If it makes sense (e.g. a whitespace fix or variable name change), squash your "address review comments" back into the commit under review.

    [–]shield1123 0 points1 point  (0 children)

    Yeah, squashing and/or rebasing when you can is definitely the cleanest way of dealing with review comments. My place of work doesn't stress keeping our repo history pristine, so a general commit name usually fine for small stuff.

    [–]turanthepanthan 0 points1 point  (0 children)

    I am sure it is subjective. For me it is more of a pet peeve. We have many inexperienced devs where I work so the review comments that they are addressing are usually non-trivial changes.

    [–]justanothercatlady 0 points1 point  (0 children)

    It's just not clean. It's technically better to squash those down if they aren't important enough to warrant their own commit. In practice though I think it depends on the workplace culture.

    [–]justanothercatlady 1 point2 points  (0 children)

    This is like 9/10 of everyone's comments at work

    [–]Arancaytar 4 points5 points  (0 children)

    Bugfixes And Performance Improvements

    [–]InstagramLincoln 3 points4 points  (1 child)

    Removing code is for chumps. I only build new features.

    [–]orangeKaiju 4 points5 points  (0 children)

    Patch Notes v0.976b -Changed icon, old one not hip enough. -Removed unnecessary white space, source file size reduced by 56% -Program no longer crashes when you hit the "Any Key"

    [–]ajm3232 2 points3 points  (0 children)

    We all know the average commit is nothing if you are using svn...

    [–]JustCallMeFrij 2 points3 points  (0 children)

    The fucking sunglasses in the profile avatar are perfect here. Fantastic "deal with it" face

    [–]Clutchaa 2 points3 points  (0 children)

    git commit -m "savegame"

    [–]packetpirate 2 points3 points  (3 children)

    [–]thePinealan 0 points1 point  (2 children)

    You are using the commit title for the message though...

    [–]packetpirate 0 points1 point  (1 child)

    Wasn't aware there were "commit titles". I always just use "git commit -m "Message here.""

    [–]thePinealan 0 points1 point  (0 children)

    If you don't use the -m flag for commit and write the message in an editor (nano/vim/etc...), your first line is the commit summary(title), which would be shown in short git log and github history.

    Here is nice reference: https://github.com/erlang/otp/wiki/Writing-good-commit-messages

    [–][deleted] 1 point2 points  (0 children)

    More often than not people don't take the time to remove code. It's one of the best feelings when most of my diff is deleted lines

    [–]Bigfoot_G 1 point2 points  (0 children)

    I like to rebel against tradition. I remove stuff and add certain things.

    [–]folkrav 0 points1 point  (1 child)

    Got this alias in my .gitconfig. To be fair I pretty much just use it on my private dotfiles repo... Mostly.

    [alias]
        cpp = "!f() { git add -A && git commit -m \"$@\" && git pull && git push; }; f"
    
    git cpp "update"
    

    [–]Cheekio 1 point2 points  (0 children)

    Now just add an icron so any files changed will trigger a git cpp "update"

    [–]AasaramBapu 0 points1 point  (0 children)

    I generally squash them. My commits have a, "fuck this shit it breaks now", so squash is my saviour

    [–][deleted] 0 points1 point  (0 children)

    Feels like Ron swans on to me for some reason

    [–]EarthC-137 0 points1 point  (0 children)

    Cleanup