Issues with pushing from VS

I’m working on a project and am trying to use Visual Studio’s built in GitHub integration, but when I try to push I get this odd error:

Error encountered while pushing branch to the remote repository: rejected Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes  before pushing again.

I’m sure this is a very easy thing to solve, but I’m very new to GitHub and don’t knkow what to do. If anyone could explain why this is happening, that would be much appreciated.

Hi @fiendfyrefox !
I have not had this especific problem but had a similar one with NetBeans and GitLab (I hope is something related).
What happened then is that when you fork a project, and you make modifications while the main repository receives modifications, there can raise a conflict if the files are the same or are related.

For example if you modifie file A modifing the lines 5 to 15, and while then the file in the main repository was modified by someone else in the lines 10 to 20, the merging process desnot know what changes to keep.
Its not required to be the same lines (or even the same files!) to get conflicts of this kind.

The solution is rather simple. In NetBeans there is an option called “Pull from upstream” that download the changes made to the main repository that are not in your fork (I don’t know the equivalent in VS but should be similar).
Normally the proccess is automatic; but if you got a direct conflict like in my example above, the editor should let you decide wich code to keep and wich to discart.