• homoludens@feddit.de
    link
    fedilink
    arrow-up
    9
    arrow-down
    1
    ·
    1 year ago

    Two new files wouldn’t create a merge conflict though (unless they have the same name)?

    • joby@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      1 year ago

      Git won’t let the second person push if their commit history doesn’t line up with the origin branch.

      It should be trivial to do a git pull --rebase to move your new commit after the upstream version, but as far as I can tell, no one on my current project remembers this (or perhaps they’re using gui tools or something). Our log is full of “merge origin/main onto main”.

        • ______@lemm.ee
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          If you use vscode, try out the merge editor. It’s a lot clearer to me when the merge diffs are huge.

          I would also say to check out the latest branch for each file you commit. If your file is file.tsx checkout file.tsx in the main branch to make sure you know what you’re changing.

          • scubbo@lemmy.ml
            link
            fedilink
            arrow-up
            2
            ·
            11 months ago

            Thanks! I’ve been tinkering with VS Code (migrating from IntelliJ) recently - I’ve found that they’re at pretty-much feature parity. VS Code makes it much harder to attach a debugger (IME, though I might just not grok it yet), but is more customizable and a lot less of a memory-hog. I think I’m comfortable adopting it as my daily driver. And, as you say, any IDE’s Merge Editor is usually clearer than the equivalent direct from the CLI!

            However, I wasn’t complaining about Merge Conflicts - I do dislike them, but they’re a necessary evil (well, until AI can resolve all conflicts itself :P ). Rather, I was complaining about Merge Commits. See my comment here for more context.

        • joby@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          I’m guessing you don’t mean commits that actually bring updates from a different branch in? I’m responsible for a bunch of commits that catch my feature branch up to main and a couple that bring my branches into main.

          If we were working on the same project, what would you want to see for those? This is hosted on a private gh repo, but it’s a small shop and we were working on a tight deadline for an MVP release and were not using PRs for the stuff I was working on.

          The boss (co-owner of the business) is the Sr dev on the project and until recently was the only sr dev in the whole shop. I actually don’t think he has experience with using git in a team context.

          One of my other tasks is working on internal docs (which didn’t exist before I joined the team) that would include git best practices for branching strategies and commit messages, so I’m interested in what folks who have more experience than I do would like to see as I try to nudge the team practices.

          • Falmarri@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            I’m guessing you don’t mean commits that actually bring updates from a different branch in?

            No, fast-forward merges only

          • Alien Nathan Edward@lemm.ee
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            merge commits that catch my feature branches up to main

            You’d be squashing those when you merge back down into main anyway, no?

            • scubbo@lemmy.ml
              link
              fedilink
              arrow-up
              1
              ·
              11 months ago

              You’d hope so - and if one does, I have no concerns about whatever one chooses to do in the privacy of their own branch - but some people insist on directly merging to main (preserving two parallel histories), rather than squashing their change into a single commit. Savages ;)