• Croquette@sh.itjust.works
    link
    fedilink
    arrow-up
    2
    ·
    8 months ago

    How would rebasing my own branch work? Do I rebase the main into my branch, or make a copy of the main branch and then rebase? I have trouble grasping how that would work.

    • JackbyDev@programming.dev
      link
      fedilink
      English
      arrow-up
      3
      ·
      7 months ago

      You’re still rebasing your branch onto main (or whatever you originally branched it off of), but you aren’t then doing a fast forward merge of main to your branch.

      The terminology gets weird. When people say “merge versus rebase” they really mean it in the context of brining changes into main. You (or the remote repository) cannot do this without a merge. People usually mean “merge commit versus rebase with fast forward merge”

      • Croquette@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        7 months ago

        Yeah I was confused because you are right, merge is usually refered as the git merge and then git commit.

        It makes sense. Thanks for the clarification

    • jaemo@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      7 months ago

      Here’s an example

      Say I work on authentication under feature/auth Monday and get some done. Tuesday an urgent feature request for some logging work comes in and I complete it on feature/logging and merge clean to main. To make sure all my code from Monday will work, I will then switch to feature/auth and then git pull --rebase origin main. Now my auth commits start after the merge commit from the logging pr.