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.
Use shelving
bzr shelve --all
bzr unshelve
Create a separate branch with the latest
- 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.
精彩评论