While programming software stored in a Subversion repo, I often modify some files, then notice that I\'d like to do some preparatory change for my main work. E.g. while impl
There is a small Python 2 script called svn-stash
available under GPL 3: https://github.com/frankcortes/svn-stash .
It works like the svn diff/patch
solutions mentioned and offers pushing and popping of changes as diffs into some local directory. Unfortunately, the stashes can not be named, and only the last one can be popped (well, yeah, it's a stack, but there is no real reason for such a limitation.) But then, you could always build the missing features into the source.
It is written for *ix, but after replacing every "/" with os.sep
it works nicely under Windows as well.
If you use svn 1.7 or higher, you need to change is_a_current_stash()
: remove the line if ".svn" in os.listdir(CURRENT_DIR):
, since there is only one top-level .svn subdir in 1.7 WC's.
Since Subversion doesn't support stash
feature perfectly,
I just do manual way like this.
Place Development
and Production(release)
project to a separated path.
source\code\MyApp -- Development
release\MyApp(release) -- Production(release)
You can work any new features for your project in the development path,
and you would only commit meaningful progress or something should be released for the stable.
When you have to release it for production, open production project, update svn and do stuff to release(build, export... etc).
I know this makes little bit troublesome, but releasing progress doesn't happen often(it doesn't for me, but I know some projects do) compare to develop progress, this way fits for me.
I'm using svn for specific projects since the project team members use it, so I have to follow.
The best solution is to use git
which has a perfect version control system and better than svn
.
When I've got uncommitted changes from one task in my working copy and I need to switch to another task, I do one of two things:
Check out a new working copy for the second task.
or
Start a branch:
workingcopy$ svn copy CURRENT_URL_OF_WORKING_COPY SOME_BRANCH
workingcopy$ svn switch SOME_BRANCH
workingcopy$ svn commit -m "work in progress"
workingcoyp$ svn switch WHATEVER_I_WAS_WORKING_ON_BEFORE
I have some scripts that help to automate this.
In my practice, I use git init
to create a Git repository in trunk
directory of my Subversion repository, and then I add *.git
to the Suctions ignore patterns.
After modifying some files, if I want to continue my work with the Subversion mainline, I just use git stash
to stash my work. After committing to the Subversion repository, I use git stash pop
to restore my modifications.