Git 清空所有commit记录方法

邓尼茨我今天去赶集 2021年12月12日 516次浏览

代码工程复制一份后,最好清空之前的所有commit记录

1.Checkout
git checkout --orphan latest_branch

2. Add all the files
git add -A

3. Commit the changes
git commit -am "project init."

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