简体   繁体   中英

How to pull and push in a remote git repository

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.

  1. First save your local changes using git stash command

    git stash
  2. Pull the changes from remote branch

    git pull
  3. Unstash your previously stash changes using below command

    git stash apply
  4. 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM