When local repository moved ahead and remote also moved ahead, the remote doesn’t allow Push. You have to first Pull. But sometimes pull doesn’t work straight forward, you have to specify the merge strategy. This happens when `–ff-only` doesn’t work for some reason.

In such a scenario, I normally use `–no-rebase` option. It creates a new commit with the merge. I can use `–rebase` also. But that is my personal preference. I want to keep the history of changes as is.

I couldn’t find `–no-rebase` option in the Magit interface. Any idea, how to do that using Magit?

ChatGPT suggests that instead of direct Pull i.e. `F u`, I should first fetch and then merge i.e. `f u` followed by merging aka `m m`. Although, I haven’t tried it yet. But just wanted to ask, if there is a direct way to achieve `–no-rebase` in Pull.

    • jangid@alien.topOPB
      link
      fedilink
      English
      arrow-up
      0
      ·
      11 months ago

      If Magit is functioning correctly, it shouldn’t error out when both the remote and local repos have been updated post the last sync. Currently, to resolve this, I resort to the CLI and run git pull --no-rebase, which prompts for a comment and creates a new commit upon saving.

      I want exactly this behavior inside Magit. Is there a setting to do that?

  • WallyMetropolis@alien.topB
    link
    fedilink
    English
    arrow-up
    0
    ·
    11 months ago

    I would also suggest fetch. Pull is fetch and merge. So if you don’t want to merge, you can just fetch.

    • jangid@alien.topOPB
      link
      fedilink
      English
      arrow-up
      0
      ·
      11 months ago

      I am okay with this approach. I just wanted to make sure that I am not missing anything. Magit claims that it provides all the features that are normally available via CLI route. So I thought may be `git pull --no-rebase` is hidden somewhere in the user interface.

  • pokkiff@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    0
    ·
    11 months ago

    I avoid the need to do this by always keeping my local changes in a branch. Then I can pull master from the remote without any merging, rebase my branch, then merge the branch back into master in a fast forward. Keeps a clean stack of commits without any merges in the history.