I am a newbie at Git and really need help in trying to solve this, as I am totally confused as to how do so.
Let's say I have two repos in Github, Repo1 and Repo2. Repo1 is my personal Repo and contains a piece of software. Repo2 is part of something else and contains the same contents as Repo1 (it's a branch).
Some time ago I managed to mess up Repo1, and also managed to update Repo2 with the incorrect information. In my attempts to fix both, I did successfully fix Repo1, but forced an update of Repo2 with the files from Repo1 (using Github for Mac) which updated Repo2 with the correct files but totally messed up Repo2's history.
Now I can update Repo1 properly, but whenever I try to fetch the files in Repo1 (upstream) to my local Repo2 I get merge errors. I tried using the solution given here: Resolve conflicts using remote changes when pulling from Git remote This appears to fix the local Repo2 (but I'm not sure...), but when I try to push the results to Repo2 on Github I get the following error message:
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/folder/Repo2.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I do not care about the history in Repo2; I just want to overwrite the whole contents of Repo2 with the contents of Repo1 and be rid of any subsequent problems. How can I do that?
Please help, as I find dealing with this entire mess extremely frustrating and I am not sure what I am doing.