Conflicting file versions (Git)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

On a beautiful autumn morning in 2023, we were greeted by a wonderful message:

$ git push
To https://github.com/acme/scripts.git
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/scme/scripts.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

and git pull made sure there was no escape:

$ git pull
error: Your local changes to the following files would be overwritten by merge:
	src/update_all_dvb8.sh
Please commit your changes or stash them before you merge.
Aborting

Options:

  • Make a local copy of the site, pull and manually incorporate my updates in this file?
  • Check on GitHub for changes
  • Commit your changes: Commit, pull, and sort things out manually
  • Stash: 'Park' your own changes and proceed with pull

BTW, merge here means, that I want to include my changes in the current branch - To merge my files into the branch

Case: 2023.12.04

  • Someone else made a change to a file and added one line
  • Made a local copy of the disputed file
  • Commit + pull
  • Git somehow solved it itself. I think the term recursive was mentioned somewhere?
  • Solved.

Impressive. Next time, do the same inlcuding making a local copy of the file before pulling.