如何模拟“git stash”在化石中,bzr?

发布于 2024-08-15 19:42:43 字数 473 浏览 7 评论 0原文

使用化石/bzr 时是否可以模拟“git stash”的行为?

基本上我对处理以下工作流程感兴趣:

  • 在某些时候源代码树具有状态 X,它已提交
  • 我继续编写新代码,我编写了一段时间,然后我看到 重构的机会
  • 我现在无法提交 ,因为我已经开始进行的更改不是 已完成,它还不是原子的,
  • 此时我会执行“git stash”,会保存当前的工作并且会 回到状态 X
  • 我将进行重构并提交,源代码现在具有状态 Y
  • 我会将状态 Y 中的源代码与存储中的代码合并,完成更改 使其原子化,然后再次提交,将源代码推送到状态 Z

我认为通常可以在使用时模拟这种情况 另一个 SCM,通过在状态 X 中分支代码而不是执行“git stash”, 在该分支中进行重构,然后将该分支合并回 主要一.但我知道分支并不总是一种廉价的操作。也是如此 有没有更好的特定方法最终依赖于特定的 化石/bzr的特点?

Is it possible to emulate the behavior of 'git stash' when using fossil/bzr?

Basically I'm interested in handling the following workflow:

  • at some point the source code tree has state X, it is commited
  • I proceed to writing new code, I write it for a while and I see the
    opportunity of a refactoring
  • I can't commit at this point, because the change I've started to make is not
    completed, it is not atomic yet
  • at this point I would do 'git stash', would save the current work and would
    get back to state X
  • I would do the refactoring and commit, source code now has state Y
  • I would merge source code in state Y with code in stash, complete the change
    to make it atomic, then commit once again, pushing the source code to state Z

I think that generally it is possible to emulate this scenario when using
another SCM by branching the code in state X instead of doing 'git stash',
doing the refactoring in that branch, then merging the branch back into the
main one. But I'm aware that branching is not always a cheap operation. So are
there any better particular approaches that eventually rely on specific
features of fossil/bzr?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

绝情姑娘 2024-08-22 19:42:43

使用 bzr shelvebzr unshelve 命令。

Use bzr shelve and bzr unshelve commands.

终止放荡 2024-08-22 19:42:43

您可以使用系统的 patch 命令。

  • 首先,通过将生成的差异存储为 .patch 文件来进行“存储”:

    $scmtool diff > working.patch

  • 然后重置您的工作目录。

  • 稍后,应用补丁:

    <代码>补丁-p1 --dry-run <稍后

  • 然后就可以了,删除--dry-run以真正应用补丁。

You can use the patch command of your system.

  • First you make a "stash" by storing a generated diff as .patch file:

    $scmtool diff > working.patch

  • then reset your working directory.

  • later, apply the patch with:

    patch -p1 --dry-run < working.patch

  • and then this works, remove the --dry-run to apply the patch for real.

凉墨 2024-08-22 19:42:43

stash 命令最近在 Fossil 中实现。您必须检查最新的化石可执行文件,您将在可用命令列表中看到stash

以下是有关其语法的网络帮助的链接。

The stash command was implemented in fossil recently. You got to check out latest fossil executable you will see stash in the available command list.

Here is the link to the web help on its syntax.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文