Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To revert the current commit to the initial commit in a Git repository, follow these steps:

  1. Use the command git log to find the commit hash of the initial commit. The initial commit is typically labeled "Initial commit".

  2. Use the command git reset --hard <commit-hash> to reset the repository to the initial commit. Replace <commit-hash> with the hash of the initial commit that you found in step 1.

  3. Use the command git push --force to force push the changes to the remote repository. This will overwrite any changes made after the initial commit, so make sure you have a backup of any changes you want to keep.