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 t
If you want to permanently delete the files from the remote repository and in retrospect as if they weren't pushed in the first place to start fresh, then base on this answer you could do the following
Run the following locally (Notice the *
deletes every folder/file):
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch *" -- --all
Now it's time to update git references locally to enforce it to forget all the history it had of those files
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
Now push all the changes to the remote repository with a FORCE to ensure the remote repo also clears all those files
git push --all --force
This would clean up the remote repository as if no file ever existed.
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.
You are unable to push because there are commit on the remote that aren't merge in to the commit that you are trying to push. If you want to discard all of the changes that are in the currently in the remote you can do something like this.
git fetch
git merge -s ours origin/master
git push origin master
Note that this throws away changes that have been introduced in the remote that you don't have in your local repository.