Our approach is to tell Git that your current commit is the initial commit. For that first checkout to the commit, which you want to make as the initial commit. Then run the following commands :
git checkout --orphan latest_branch git add -A git commit -am "Initial commit message" #Committing the changes git branch -D master #Deleting master branch git branch -m master #renaming branch as master git push -f origin master #pushes to master branch git gc --aggressive --prune=all # remove the old files
The above commands will forcefully push the current source code to the master branch as the first command.
Note: You should delete all other branches and tags, because it may still contain the old history.