I have local git repository for a jekyll website the compiles and renders correctly. The older version on GitHub has some errors in it and I would like to completely overwrite it with the version from local, however when I try to do a git add -A and then git push, it tells me there is nothing to update. Is there a simple way to force it to push what I've got locally, and remove anything that is not in the local directory? I've tried several things with git but no luck. Um running Ubuntu Linux 14.04.
Asked
Active
Viewed 419 times
1
-
I think this is what you're looking for http://stackoverflow.com/questions/10510462/force-git-push-to-overwrite-remote-files [1]: http://stackoverflow.com/questions/10510462/force-git-push-to-overwrite-remote-files – Dillon Aug 26 '15 at 08:46
-
Check you're on the right branch. What does git status say? – Jonathan Goodman Aug 26 '15 at 09:53
1 Answers
0
git add is not enough, you need to git commit -m "your message"
Also, when pushing you will have an error saying your current branche is behind the remote. You can force the push by adding -f
to your command, i.e. git push -f origin master
(assuming github repository is named origin
and you want to override the master
branch).
Note that if your github repository is public, all people who have cloned your repo may have big difficulties to synchronize with your new branches.

Asenar
- 6,732
- 3
- 36
- 49