Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How commit all files except one with SVN

Tags:

I want to commit all modified files except one using Subversion.

So here is the scenario:

$ svn st M    file1 M    file2 M    file3 M    file4 

I can do something like this:

svn ci -m "Commit 1" file1 file2 file3 svn ci -m "Commit 2" file4 

But when a large number of files, I'm trying to simplify my work:

svn ci -m "Commit 1" `svn st | awk '{print $2}' | grep -v file4` svn ci -m "Commit 2" file4 

This solution is very fragile, because this scenario not works:

$ svn st M    file1 M    file2 D    file3 A +  file4 

I think that SVN does not have a built-in solution for my problem, but I'm not sure. Any other approach?

like image 639
Arturo Herrero Avatar asked May 24 '12 14:05

Arturo Herrero


People also ask

How do I commit multiple files in svn?

Select any file and/or folders you want to commit, then TortoiseSVN → Commit.... The commit dialog will show you every changed file, including added, deleted and unversioned files. If you don't want a changed file to be committed, just uncheck that file.

How do I commit all files in svn?

svn list <URL> Lists all the files available in the given URL in the repository without downloading a working copy. svn add <filename> Use this command to add new files or changed files to the commit list. svn commit m “Commit message” Commit the added files using a commit message for better traceability.

What is difference between commit and update in svn?

Commit uploads your changes on the CVS / SVN server, and Update overwrites the files on your localhost with the ones on the server.


2 Answers

Option 1, AWK:

svn ci -m "Commit 1" `svn st | awk '{print $NF}' | grep -v file4` svn ci -m "Commit 2" file4 

Option 2, --targets:

svn ci -m "Commit 1" --targets filesToCommit.txt svn ci -m "Commit 2" file4 

Option 3, --changelist:

svn changelist my-changelist file1 file2 file3 svn ci -m "Commit 1" --changelist my-changelist svn ci -m "Commit 2" file4 
like image 103
Arturo Herrero Avatar answered Nov 10 '22 13:11

Arturo Herrero


You can do it like this:

svn diff file4 > tmp.patch svn revert file4 svn ci -m "Commit 1" svn patch tmp.patch 

At this point all files are commited except file4

like image 34
ks1322 Avatar answered Nov 10 '22 14:11

ks1322