重写GIT历史的实际后果是什么? [英] What are the practical consequences of rewriting GIT history?

查看:86
本文介绍了重写GIT历史的实际后果是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的项目现在一直在使用git一个星期左右,我们都很喜欢它(在一个紧密的合作团队中使用它变成了完全不同的git体验)。为了让事情尽可能简单,我们不做任何重塑或历史修改。但是我们在第一周确实犯了一些错误。有些提交不应该完成,我们设法将一个功能分支合并到错误的集成分支(1.1而不是1.0)中。我们直到他们进入我们的历史时才知道这些事情。



现在我看到很多关于重写历史的警告,但我并不是真的当然我明白所涉及的危险。我们使用一个共享裸仓库,并且所有分支都被推送到那里进行备份。



我认为如果你重写历史记录(比如删除一个提交),完整列表后续的提交将会失去提交(也可能不是编译/工作)。我也希望,如果发生这种情况,我实际上可以选择将其解决在历史的顶部(并且将这部分历史记录保留为非编译)。




  • 如果我重写历史记录(并且所有受影响分支中的所有内容都编译/运行),我的同事是否需要执行任何特殊命令? (换句话说,如果我做得好,他们会知道我已经完成了它)
  • 具有我不知道的本地更改的任何用户是否有资格获得合并失败


  • $ b

    任何对文章/关于这个主题的教程也会非常好。

    解决方案

    必需的阅读材料是重写历史记录的问题在Git用户手册中。


    如果我重写历史记录(并且所有受影响的分支都编译/工作),我的同事是否需要执行任何特殊命令知道我已经做到了,如果我做得很好的话)?

    他们会知道的,Git会告诉他们没有不确定的术语 是错误的。他们会得到意想不到的错误消息,并可能在尝试解决所产生的合并冲突的过程中,无意中恢复先前的提交。这个问题产生了一个真实的信息,如果你想知道发生了什么,你可以试试它的临时副本。


    <


    当然,我不知道有哪些本地更改的用户有资格在git pull上合并失败?


    我是否缺少必要的东西?




    避免重写历史(几乎)所有成本!


    Our project has been using git for a week or so now, and we're all enjoying it a lot (usíng it in a tight collaborative group turns out to be quite a different git experience). To keep things as simple as possible, we do not do any rebasing or history modifications. But we did make a few mistakes in the first week. A few commits were made that shouldn't have been done, and we managed to merge a feature branch into the wrong integration branch (1.1 instead of 1.0). And we didn't find out about these things until they were long into our history.

    Now I see a lot of warnings about rewriting history, but I'm not really sure I understand the dangers involved. We use a shared bare repository, and all branches are pushed there for backup.

    I would expect that if you rewrite history (say remove a commit), the full list of subsequent commits will "lose" that commit (and maybe not compile/work). I would also expect that if this happens I could actually choose to fix this at the top of history (and just leave that part of history as non-compiling).

    • If I rewrite history (and everything compiles/works in all affected branches), will my co-workers need to do any special commands)? (In other words, will they "know that I have done it" if I did it well?)
    • Will any users with local changes that I do not know about be eligible for merge failures on git pull?
    • Am I missing anything essential here?

    Any references to articles/tutorials on this subject would also be really nice.

    解决方案

    Required reading is Problems with rewriting history in the Git User's Manual.

    If I rewrite history (and everything compiles/works in all affected branches), will my co-workers need to do any special commands (i.e. will they "know that I have done it" if I did it well?)?

    They will know, and Git will tell them in no uncertain terms that something is wrong. They will get unexpected error messages, and may in the process of trying to resolve the resulting merge conflicts, inadvertently revert previous commits. This problem creates a real message, and if you're curious to see what happens you can always try it on a temporary copy of your repositories.

    Will any users with local changes that I do not know about be eligible for merge failures on git pull ?

    Absolutely, see above.

    Am I missing anything essential here ?

    Avoid rewriting history at (almost) all costs!

    这篇关于重写GIT历史的实际后果是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆