gitgithub

Git: Clear local and remote repo and start over


I accidentally got a repo in a bad state when trying to move a project from using ant to maven. Now, I would like to clear the repo and startover from scratch. Being new to git, I am a little cautious and not sure if I could just checkout then delete all files and folders locally then push to the remote repo or if that was actually a very bad idea.


Solution

  • Simply remove local .git directory, remove repo from server (if it is github - do Repo -> setiings -> remove).

    Then create new repository on server, and locally do:

    git init
    git remote add origin git@github.com:user/project.git
    git add .
    git commit -m "Initial commit"
    git push -u origin master