I worked in a project on my desktop and pushed it in master branch. Now i am working on my laptop with same project by downloading it in my laptop. After making some changes i want to marge this to my Github repository. But says an error which is
error: failed to push some refs to ' https://github.com/mahfuz380/loginsystem ' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (eg hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Please follow the below steps when you try to push changes to remote branch.
First save your local changes using git stash command
git stash
Pull the changes from remote branch
git pull
Unstash your previously stash changes using below command
git stash apply
Push your changes to remote branch
git push origin
If you encountered any conflicts once you unstash the changes then please resolve the conflicts manually and then push.
Hope it helps!
git pull
first before you push. You might have to undo your changes first.
As the message hinted, you should pull
first to merge the changes, and push to remote.
git pull origin master
git push origin master
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.