问题
I tried using svn ci dir/a dir/b -m "my comment" but this doesn't work. I also used svn ci dir/a/* dir/b/* -m "my comment" and it too doesn't work.
I know you can specify multiple files, but how can I tell subversion to check in all modified files in these folders? I mainly want to do this so that all my changes get in on one revision. I can checkin one directory at a time, but this ends up giving me different revisions for each directory..
回答1:
I think you only have 1 option: check in the containing directory - the one that has both these as subdirs.
If they're not organised like that already (ie they're both top-level directories in the repo), then there's not a lot you can do - the svn commands work on a single directory only.
回答2:
You may need to specify what does "but this doesn't work" mean because it works fine here:
D:\Projects>svn commit -m 'test1' test\aaa "test\aaa bbb ccc"
Sending test\aaa\aaa222\xxx.txt
Sending test\aaa bbb ccc\aaa.txt
Transmitting file data ..
Committed revision 8.
D:\Projects>
回答3:
svn add dir/a
svn add dir/b
svn commit
Though, more likely, you're thinking:
svn add dir/*
svn commit
回答4:
You can use --changelist option, on top directory create one changelist with all files you want to commit, after, commit that changelist.
source and info: svn book: changelist
回答5:
This is easy if you check-out from a higher level folder for where a and b are. So if your working copy is "dir" and a and b have changes, commit "dir" to commit changes to both. I do this all of the time.
Edit:
To commit more than one folder, you will need for them to be in the same working copy.
If you are worried about having too much to process, you could try a sparse checkout with only the folders you need, and then you could just commit the base directory or the subdirectories as needed without the overhead of the other projects.
Sparse Directories Information
回答6:
Consider using svn:externals property for checking out part of the repository. You can pick and choose which directories to get, then commit to multiple destinations in a single step. We've been using this approach for a while with great success.
回答7:
Considering the below is the query
- you have lot of files checked out from the repository into multiple directories and many of them got modified and you do not remember which files got modified and you it will be difficult to merge one file at a time, then do the following
go to the top-level directory and run the command
svn ci -m "comments"
this will check-in all the modified files under the top-level directory and many subdirectories below it.
回答8:
A encountered similar problem. I had one repository and I needed to have two separate working copies of some of the repoeitory's subfolders. Repository was like this:
/web/lib
/web/htdocs
...
... which I needed to have in separate working copies (respectively):
C:/.../web/lib
C:/.../htdocs/cbs
I solved this by having a "master" working copy of /web
in C:/.../web
and creating a hardlink (or NTFS junction) in C:/.../htdocs/cbs
"pointing" to C:/.../web/htdocs
. So whenever I make local changes in one of those working copies, I always commit the C:/.../web
, which naturally contains changes from both working copies.
I hope this way may be useful for You.
回答9:
It has been a long time since this question was asked, but I have an update for any late arrivals.
Assuming you have a tree like dir/a, dir/b, dir/c, dir/d.... and want to commit changes only in subfolders a and b, the following command works:
svn ci dir/a/* dir/b/* -m "my comment"
If this truly didn't work when you tried it seven years ago, I can only assume that this feature was added in subsequent releases.
来源:https://stackoverflow.com/questions/878834/how-can-i-commit-multiple-directories-at-once-using-subversion