I am working on a project and using github as our source control server. The project is private and I want to make it public. But some credential is saved in the history of my git repo. I want to remove the history of commits and only keep the last commits for all branches. I know that I can do this by below commands.
Checkout
git checkout --orphan latest_branch
Add all the files
git add -A
Commit the changes
git commit -am "commit message"
Delete the branch
git branch -D master
Rename the current branch to master
git branch -m master
Finally, force update your repository
git push -f origin master
but I am worried about other team members. If I follow above steps to clear the history but other team members don't, will they have trouble when they run git pull
? Or will they bring the history back when they run git push
?