Commit the old project to git, but there will be some history, which may contain sensitive information such as project passwords. How to delete this history, form a brand new repository, and keep the code unchanged?
The following method is to create a new branch under the current branch, then delete the previous branch, then rename the new branch to the original branch name, and finally push the branch to the remote
1.Checkout
git checkout --orphan latest_branch
2. Add all the files
git add -A
3. Commit the changes
git commit -am "commit message"
4. Delete the branch
git branch -D master
5.Rename the current branch to master
git branch -m master
6.Finally, force update your repository
git push -f origin master
Enter the file submission directory
git init
git remote add origin https://github.com/****/****.git
git status View status
touch README.md documentation
git add . add all files
git add README.md add the specified file
git commit -m "commit description"
git push origin master push to master
git clone https://github.com/***/*** clone to local
git rm pom.xml delete file
git rm -r src/ delete directory