0

I created a repository, added some commits, pushed to GitHub.

Later, I created a new project, new local git repository and I wanted to commit new files from new repository to the old repository on GitHub. So I executed: git push --force origin master but this command removed all previous commits from the repository on GitHub.

Is there a way turning back? How to make it properly next time?

Defozo
  • 2,946
  • 6
  • 32
  • 51
  • 2
    To "make it properly next time", don't use `--force`. – Oliver Charlesworth Aug 29 '16 at 14:52
  • Push the old master reference again. And the proper way would be to never force push except when you know *exactly* what you are doing. You could also use the `--force-with-lease` option. – poke Aug 29 '16 at 14:52

0 Answers0