Git was telling you that it thought that the remote branch had commits that you didn't have,
and that you had commits that the remote didn't have. It was instructing you to "pull" the remote commits down, so that what you then "pushed" would consider those commits and thus maintain the proper sequence.
– – –
It's very important to remember that Git considers
everyone's system to be "a repository." The true genius of this system is that:
"there is no 'one authoritative source of truth – there is no 'server.'"
Instead – and this will
save your a&s!! – "everyone is 'a backup.'"
Naturally, there are certain specific "agreed-upon 'authoritative sources'" that are very carefully maintained – through "pull requests" and so-forth – but the central concept is still grounded in
"mutual synchronization." Which happens to be an idea that had never been done before . . . ("Typical Linus ...")
"Your repository is 'not in-sync' with theirs, because you have updates they don't have, and they have updates you don't have." Git provides a very straightforward way to deal with that.
But, for the individual developer working on his own machine,
"effective version control." No 'server,' no mess, no bother.
"Oh sh&t, I just screwed up ..." Solution:
"Poof!" ... ... "Oh sh&t, I actually didn't screw up ..." Again: "Poof!"
I can very-confidently tell you that there is not a single "project
directory," on any one of my (fairly recent ...) personal systems, which
isn't 'a Git
repository.' That's the brilliance of the whole thing.