Git - Clear history

          

Scenario: Start afresh for your Git repository

Solution:

1. Git Bash -> navigate to your repository and execute below command line commands.

    -- Remove the history from
    rm -rf .git
    -- recreate the repository from the current content only
    git init
    git add .
    git commit -m "Initial commit"
    -- push to the github remote repository [overwrite history]
    git remote add origin git@github.com:<Account>/<Repository>.git
    git push -u --force origin master

  

No comments:

Post a Comment

Move Github Sub Repository back to main repo

 -- delete .gitmodules git rm --cached MyProject/Core git commit -m 'Remove myproject_core submodule' rm -rf MyProject/Core git remo...