【问题标题】:Remove old aliases and email from ALL commits从所有提交中删除旧别名和电子邮件
【发布时间】:2017-02-01 12:23:43
【问题描述】:

我刚刚注意到我的计算机名和个人电子邮件被用作别名和电子邮件,而不是我的 GitHub 用户名和电子邮件。

有没有办法从 GitHub 中完全删除所有提交以及所有历史记录?

【问题讨论】:

    标签: git github directory delete-file


    【解决方案1】:

    是的,有!见下文。

    但是,在这种情况下,您可能也有兴趣只需在所有提交上替换您的姓名和电子邮件地址https://help.github.com/articles/changing-author-info/


    来自how to delete all commit history in github?Make the current commit the only (initial) commit in a Git repository?

    这取决于您是否也想删除所有配置。如果这不是问题:

    rm -rf .git
    git init
    git add .
    git commit -m "Initial commit"
    git remote add origin <github-uri>
    git push -u --force origin master
    

    您可以在之前保存您的.git/config,然后再恢复它。


    或者,将代码保留在当前状态,但删除之前的所有内容(通过将新分支设为新的“主”分支)

    git checkout --orphan latest_branch
    git add -A
    git commit -am "commit message"
    git branch -D master
    git branch -m master
    git push -f origin master
    

    【讨论】:

    • 前段时间我在 sourceforge git repo 中更改了我的电子邮件。有关下游用户应如何赶上的说明,请查看 2014-03-07 news entry
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-19
    • 2019-09-18
    • 1970-01-01
    相关资源
    最近更新 更多