rejected master -> master (non-fast-forward)

Posted by

Error

! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/MyHospitalNow/mhn-doctors-ms.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull …') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Solution:

Your local Git branch is behind the remote branch, which is why Git is blocking you from pushing changes to the remote repository that would cause a non-fast-forward update. This is why you are receiving the error message. You must first synchronise the modifications made in the remote branch with your local branch in order to fix this problem. Here’s how to accomplish it:

Step 1: Pull Changes from the Remote Branch:

You should start by pulling the latest changes from the remote repository to your local branch. To do this, open a terminal and navigate to your project’s directory and run the following command:

Step 2: Using this command, you can merge the most recent modifications made to the remote “master” branch into your local branch.

Settlement of Disputes (If Any):

You will need to resolve any conflicts that may exist between your local changes and the remote changes. If there are conflicts, Git will let you know and offer advice on how to fix them.

Step 3: Make Your Changes Known:

In case you haven’t already, commit your changes after resolving any conflicts and ensuring that your local branch is updated with the remote branch:

Step 4: Push Your Changes:

Now, you can attempt to push your changes again to the remote repository:

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x