| First Do this … | |
| git fetch origin master | |
| git merge master | |
| Then, do this … | |
| git fetch origin master:tmp | |
| git rebase tmp | |
| git push origin HEAD:master | |
| git branch -D tmp | |
| Now everything works well | 
How to solve this problem of “! [rejected] master -> master (fetch first)”
! [rejected] master -> master (fetch first)
! [rejected] main -> main (fetch first) error: failed to push some refs to ‘https://github.com/imran/project.git’ hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused
source: https://gist.github.com/sharbel93/ebcf0b18782573f4d95f80caa3c84acb