10

could you please help me to solve my issue? Error occurs when I try to pull from "dev" branch. I browsed the solution and it says that I need to "rebase" but it didnt work out foe me.

CT+aohc@MP1GYWQA MINGW64 /c/TCO/source/RAPMD.Web.Frontend (web_feature/TCORAPD-122389-1)
$ git pull origin dev
From https://dev.azure.com/xxxx/xxxx/_git/TCO-FGP-Rapmd
 * branch                  dev        -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.
GGotchaA
  • 165
  • 1
  • 1
  • 10
  • 4
    Do you have local changes in the same branch? What does `git status` tell you? – Alexis Määttä Vinkler May 31 '22 at 10:43
  • 4
    What did you try exactly? `git rebase origin/dev`? And what does "didn't work out for me" mean? Did you get any error or what happened? – Jay May 31 '22 at 10:43
  • Does this answer your question? [Fatal: Not possible to fast-forward, aborting](https://stackoverflow.com/questions/13106179/fatal-not-possible-to-fast-forward-aborting) – Vikram Feb 28 '23 at 18:49

3 Answers3

25

You can follow the following steps:

  • Run git pull --rebase origin dev
  • if you face conflicts then you need to solve those conflicts and run
    • git add <file_name>/ git add .
    • git rebase --continue
  • continue second step until you solve conflicts(remeber rebase compare changes commit wise)
    • Then run git rebase --skip if needed
  • After you successfullly aplied rebase you need to force push the changes
    • Run git push --force-with-lease origin dev (safer way of force push) OR git push -f origin dev

FOR REFERENCE: https://gitexplorer.com/

Monish Khatri
  • 820
  • 1
  • 7
  • 24
20

Easiest way, This worked for me:

git fetch origin dev
git merge origin dev

Replace dev with branch_name you want to pull.

Harish Kulkarni
  • 1,481
  • 11
  • 18
2

Just add --no-rebase to your pull command e.g., git pull origin --no-rebase

This will take u to merge and a editor might open. Write :WQ and enter

you should be able to successfully pull now.