Sep 22, 2021
Life long learner
Troubleshooting an issue
I encountered an issue while pushing my code from local repository to its remote version today. 

Here's what I learnt:

THIS WAS THE ERROR


To repository
 ! [rejected]  local-repo -> remote-repo (non-fast-forward) 

error: failed to push some refs to 'https://github.com/Marrockx/zc_plugin_channels.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.



HOW I SOLVED IT

I found  an helpful article from GitHub docs from my Google search which can be viewed below: 

First Solution

$ git pull origin YOUR_BRANCH_NAME
# Grabs online updates and merges them with your local work
Second Solution 

git merge branch_name
git checkout branch_name
git merge --no-ff feature_branch
git push -u origin branch_name

You can see other solutions as well

https://docs.github.com/en/get-started/using-git/dealing-with-non-fast-forward-errors

I hope you find it useful.