1. 程式人生 > >git 刪除遠端提交記錄

git 刪除遠端提交記錄

不小心把密碼提交到github怎麼辦?

1.切換到新的分支

   git checkout --orphan latest_branch
  1. 快取所有檔案(除了.gitignore中聲名排除的)
   git add -A
  1. 提交跟蹤過的檔案(Commit the changes)
   git commit -am "commit message"
  1. 刪除master分支(Delete the branch)
   git branch -D master

5.重新命名當前分支為master(Rename the current branch to master)

   git branch -m master

6.提交到遠端master分支 (Finally, force update your repository)

   git push -f origin master

其他方法