zehelvion zehelvion - 3 years ago 161
Git Question

Delete everything and upload new version

We are using git for version control and right now we are getting a lot of warnings when trying to upload the most recent version. I am new to git and don't have patience for the restrictions, is there any way to delete everything and upload the current version?

This is what I get now when trying to upload.

$ git push origin master
Username for 'https://code.google.com':
Password for 'https://<removed>@code.google.com':
To https://code.google.com/p/<removed>/
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://code.google.com/p/<removed>/'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Answer Source

1.) Delete everything in your repository folder

2.) run git rm * to tell git to remove all files (check with git status whether there are any unstaged files left)

3.) do a git commit -a -m "commitmessage" a git push origin master to delete all files on the remote git server

4.) check if you have an empty remote repository now

5.) copy all new files to the local repository folder

6.) run git add * to tell git to add all new files (check with git status whether there are any unstaged files left)

7.) commit and push the new files

Now you should have the version on your remote git repository.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download