I installed the same Git repository on my local computer and I would like to add my changes to the remote repository.
My local repository is the newest repository and I would like to overwrite all content that is remote, as if I would just copy my files into a folder.
I have taken the files with a USB stick to my local computer and everything on my local computer is right.
I get the following error message.
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:happymen.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.
What can I do to submit my files to this repository? I want to OVERWRITE all content that is there! And submit everything as one folder with content.
Can someone please help explain the steps?
You can force push
git push -f
Note that this is dangerous. The message
the tip of your current branch is behind its remote counterpart
means that there are commit(s) on the remote that you don't have. If you force push you could literally wipe out those changes. If you are aware of this and it is ok then fair enough.
Normally this message means you need to do a
then resolve any merge conflicts and add and commit those changes
You can also just do a git fetch to see the changes come in from the remote to your local remote copy, e.g. origin (not your local files) and then you can do a
git merge or
git pull and then resolve and push.
then you push (not force) to the remote.
See also http://stackoverflow.com/a/14464190/631619
One simple step is to delete the current master branch and recreate it with your latest code . You can also take a backup of your current master in case you would like to have it for reference .
git push origin --delete master
Then create a master branch and push your new code .