views:

64

answers:

2

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

+4  A: 

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.
Chandra Patni
Shelving is what I needed.
Matthew
+1 Excellent answer :)
Kristopher Ives
You may want to use `bzr shelve --all` if you don't want to go through usual interactive selection process.
bialix
Thanks for the comments. I have modified the answer.
Chandra Patni
+2  A: 

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.

Greg Hewgill