我正在开发一个项目,我想看看它在最新版本中的运行情况。我该如何做才能不丢失我的更改?

发布于 2024-08-16 14:26:35 字数 38 浏览 3 评论 0原文

具体来说,我使用的是 bzr,但欢迎提供任何 VCS 的提示。

Specifically, I'm using bzr, but tips for any VCS are welcome.

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

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

发布评论

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

评论(2

少年亿悲伤 2024-08-23 14:26:35

我认为有三种选择。

  1. 使用搁置

    bzr 搁置 --all
    bzr 取消搁置

  2. 创建一个单独的分支
    最新

  3. 为你创建一个补丁
    更改并恢复更改。
    当您需要时应用补丁
    变回来。

I think there are three options.

  1. Use shelving

    bzr shelve --all
    bzr unshelve

  2. Create a separate branch with the
    latest

  3. Create a patch of you
    changes and revert the changes.
    Apply patch when you need your
    changes back.
诠释孤独 2024-08-23 14:26:35

使用 Git

git checkout HEAD^    # get the previous version, changing files on disk to match
make                  # run your project (or whatever command you use)
git checkout master   # return to the "master" branch

如果您已经提交了当前正在处理的任何更改,并且想要返回到上一个提交。如果您有尚未提交的更改,请使用 stash

git stash             # save the uncommitted changes away
make                  # ...
git stash pop         # restore your uncommitted changes

您可以在存储和弹出之间进行并提交其他更改;这是 Git 针对“老板因立即错误修复请求而中断”问题的解决方案。

Using Git:

git checkout HEAD^    # get the previous version, changing files on disk to match
make                  # run your project (or whatever command you use)
git checkout master   # return to the "master" branch

The above applies if you've already committed whatever current changes you're working on, and want to go back to the previous commit. If you have changes that have not been committed yet, then use the stash:

git stash             # save the uncommitted changes away
make                  # ...
git stash pop         # restore your uncommitted changes

You can make and commit other changes in between the stash and the pop; this is Git's solution to the "boss interrupts with an immediate bug fix request" problem.

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