How can I push the local repo changes to remote repo and remote has already updated files which I don't have? We are working in a team so continuously there are changes that need to be pulled first but unfortunately, my code gets disappeared when I pull it.
I am using the following commands: In order to PUSH
git add .
git commit -m 'msg'
git push -u origin development
! [rejected] development -> development (fetch first)
error: failed to push some refs to 'https://github.com/gsesltd/metis_maza.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
In order to PULL:
git pull origin development
My files get updated and all my written code is gone now. Thanks to git reset that I have my code.
Can somebody please tell me how can I push the code without force push + I want to have all the remote updates too? How can I do that?