Question

I began encountering the following issue: I have forked a repository on gitHub and i'm working on a public branch that nobody else is working on and, from time to time, when i try to push things (git push origin [branchName]) i get the message that tells me that there is more work on the remote branch than on my machine and tells me to update. Then i update, but some the changes i made since the last push are reverted.

Could please somebody tell me what is going on?

P.S. i think this tends to happen after i make a pull request on gitHub and after that continue to push code on the same branch And also sometimes i see conflicts on the files that i continue to work

Thanks for any help!

Was it helpful?

Solution

If you have conflicts and you don't resolve it properly then git will find differences between your local and remote branch so this might be the case. After all if you are 100% percent of your code you can force push with push -f to get rid of the mess in your remote.

OTHER TIPS

I would change your git flow. Pushing on a branch submitted for pull-request will necessarily have unexpected behavior (modifying the pull-request and the branch, or the kind of problem you have now depending on various options).

A best practice would be to branch off from your main branch for developing features, merging them in the main branch when you are satisfied and then submitting the PR, even if you are alone !

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top