开发者

I'm working on a project, and I want to see how it ran in its last revision. How do I do it without losing my changes?

Specifically, I'm using bzr, but tips for any VCS are welco开发者_StackOverflow社区me.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜