Was digging through a project at work today where some guy in 2014 made 100+ commits in a single day and the only one that had a comment said “upgrading to v4.0”.

  • @[email protected]
    link
    fedilink
    32 years ago

    [JIRA-123] Quick summary of objective

    Justification (if applicable) Bulleted, high-level overview of important bits Any relevant test results done that won’t also be done in CI

  • @[email protected]
    link
    fedilink
    52 years ago
    • “progress on [1], fixed linting [2]”
    • “[1] completed, setup for [2]”
    • “[3] and [4] completed”
    • “fixed formatting”
    • “refactoring [1] and [2]”
    • “fix variable typos”
    • “update logic in [2]”
    • “revert package.json and regenerate package-lock”

    All my commits have comments. I generally commit after completing a ‘block’ objective, a describe what that was but in very simple terms mostly in regards to the file/section with the most significant logic changes. I don’t always specify the file if I did tiny typos/linting/annotation across a bunch of them, because the logic is unaffected I know that the differences will be visible in the commit history.

    My weakness is that I don’t do it often enough. If I’m working on [2] for several hours, I’ll only commit when I consider it minimally-viable (completed 2), or when moving between machines ([further] progress on 2). And I have a bad habit of not pushing every time I commit, just at the end of the day or when moving between machines (though a messy rebase hopefully made that lesson stick), or if somebody else on the team wants to review an issue I’m having.

  • @[email protected]
    link
    fedilink
    English
    12 years ago

    I try to follow https://www.conventionalcommits.org/en/v1.0.0/

    For me, the need it: when production is on fire, as a responsible person, I want to be able to understand why the change of this commit has been made. Perhaps also what were the drivers of the implementation.

    I also have this onliner to commit and push each 10min:

    watch -n 60 'git add . ; git commit --allow-empty-message -m ""  ; git push'
    

    But those commits would never be merge as they are to master or main. It’s just if I loose work on my laptop. Worst case a git rebase HEAD~ has to be done before the PR review.

    • hallettj
      link
      fedilink
      7
      edit-2
      2 years ago

      I totally agree.

      Right now I’m on a new project with a teammate who likes to rebase PR branches, and merge with merge commits to “record a clean history of development”. It’s not quite compatible with the atomic-change philosophy of conventional commits. I’m thinking about making a case to change style, but I’ve already failed to argue the problem of disruption when rebasing PR branches.

    • @[email protected]
      link
      fedilink
      62 years ago

      Enforced by pre-commit, conventional commits has cleaned up our commit logs and changelog so much.

    • key
      link
      fedilink
      52 years ago

      That’s pretty neat. Is there a forked version that adds ticket number as a mandatory first class citizen? Cause that’d be darn near perfect.

  • korstmos
    link
    fedilink
    112 years ago

    The change written as a command

    Until I get frustrated by something and just start committing “yeet”

    • Canadian Nomad
      link
      fedilink
      English
      32 years ago

      I feel like this might be a good case for LLMs… Auto git commit suggestions based on the diff.

      • @[email protected]
        link
        fedilink
        English
        52 years ago

        There are already some attempts but I don’t think it will work, harmful even. Best case scenario, the AI can understand the code as well as a senior engineer from another company. All they can know without the context is what was changed, which is useless. We need the reason why the commit was made, not what was changed. The info is not there in the first place for the AI to try to extract.

  • lohrun
    link
    fedilink
    902 years ago

    git commit -m “minor tweaks”

    +3,276 -4,724

    • VanillaGorilla
      link
      fedilink
      112 years ago

      I had one of those and it was two in the night and I was tired and forgot what I did and committed stuff, I dunno.

      But normally I’m a good boy and prefix with the ticked id and write down the change and attempted fix.

  • andrew
    link
    fedilink
    English
    8
    edit-2
    2 years ago

    When I eventually (usually) rebase, declarative statements of what the commit would accomplish if applied.

    When I am testing CICD or generally need to push more frequently for whatever reason, it’s humor and angst all the way.

    Ffffffuuuuuuuuu

    Pls, why

    Okay yeah that was important I guess.

    (⁠╯⁠°⁠□⁠°⁠)⁠╯⁠︵⁠ ⁠┻⁠━⁠┻

  • @[email protected]
    link
    fedilink
    12 years ago

    Like the default Merge messages that git creates.

    “Add some new feature” “Fix this and that” “Refactor XY code”

    Not “Adding”, “fixed”, “Refactors” or anything…

  • @[email protected]
    link
    fedilink
    252 years ago

    You get two options.

    Normally it’s a squashed commit of everything in a feature, with a commit message like:

    [JIRA-1234] - Descriptive but Concise Name of Feature
    

    But every now and then it’s multiple commits like:

    quick fix
    Ugh, fix typo
    fuck fuck why doesn’t it work
    Oh, I’m stupid
    
  • raubarno
    link
    fedilink
    22 years ago

    Looking at the log of my solo project, I could say the formula of my commit message is Verb the Subject, the Verb being Added/Tweaked/Removed, etc., and the subject of what is being changed. As I’m using git commit -m 'Message' GNU Bash every time (none of the clients tend to work well for me + git self-hosting practice over SSH), I just try to make one-liners and without entering an external editor.

    Although my professional experience is scarce. For most of the time, I’ve been creating but not maintaining my projects. My projects do not have a decent high-level structure, I do not test my codebase, I learn my code by heart and follow intuition. I tend to think in algorithms, rather than structural design patterns. Even for my newest project, the main.rs is bloated, the functions are not in the correct modules (a.k.a. files), the modules are improperly named. Alhough, I cannot believe in myself I am approaching 3.5K lines of code (separated over two repositories) but I can still navigate…

  • @[email protected]
    link
    fedilink
    5
    edit-2
    2 years ago

    I like my company’s style:

    For issues:

    <jira ticket> - [program][deliverable] did this to fix that

    Problem: symptoms of the problem that future devs can use to figure out its the same problem

    Root cause: why this is broken

    Solution: how I fixed it, including the scope

    Testing: what testing it has it gone through

  • @[email protected]
    link
    fedilink
    11
    edit-2
    2 years ago

    My commits tend to be pretty verbose. Here’s an example log from one of my projects.

    I follow the standard imperative style for the commit title, and then I use the body to summarize any important internal changes, reflect on the overall project status (for example, what milestones this commit crosses or what other work it might enable or require), and state what I’m going to work on next. I’m sure some people find it too wordy, but I like having the commit history show lots of details about the overall status.

    Edit: I always have a descriptive summary, i.e., never one word commits or similar.

      • fmstrat
        link
        fedilink
        22 years ago

        I’m not sure I do. I wouldn’t want to read all that just to find the item that broke. Might be faster to read the code.

          • fmstrat
            link
            fedilink
            12 years ago

            I use alias gl='git log --graph --abbrev-commit --no-decorate --date=format:'\''%Y-%m-%d %H:%M:%S'\'' --format=format:'\''%C(8)%>|(16)%h %C(7)%ad %C(8)%<(16,trunc)%an %C(auto)%d %>|(1)%s'\'' --all' It will change your world.

            • @[email protected]
              link
              fedilink
              22 years ago

              That is sexy. My only problem is that I tend to run my Git operations in a pretty small tmux pane on the side of my editing pane, so that layout ends up being too wide to fit well. I’ll definitely keep that alias around for when I have a full screen though!

              • fmstrat
                link
                fedilink
                12 years ago

                Haha yea I have written a number of git and docker aliases over the years that are permanently in my dotfiles. I’m always in screen but perhaps will get into this newfangled tmux.