109

I tried to commit multiple files across different directories in a single shot as below,

svn commit –m”log msg” mydir/dir1/file1.c mydir/dir2/myfile1.h mydir/dir3/myfile3.c etc etc

Since, I wanted to exclude some files from the commit list so I’ve placed each file name in the command line as above. I put it together in the notepad and it came about 25 files. When I copy and paste it on the command line, the last few files are missing and I guess this might be a command line buffer limitation (?). Is there any option I can increase the buffer length?

Is there any option I can put all files in a text file and give it as an argument to svn commit?

Rafe Kettler
  • 75,757
  • 21
  • 156
  • 151
Thi
  • 2,297
  • 7
  • 26
  • 36
  • 8
    @Thi - Those who don't use a GUI for subversion are masochists. Get Tortoise SVN or it's Linux equivalent. – tpow Dec 02 '10 at 13:56
  • 1
    If there is a restriction on buffer length, it won't be in SVN, it will be in whatever shell you are using. – Colin Fine Dec 02 '10 at 13:56
  • 22
    @cinquTimo: you might prefer to use a GUI for everything. Other people don't. – Colin Fine Dec 02 '10 at 14:00
  • @Colin, I think so, how to increase the shell buffer length in that case? – Thi Dec 02 '10 at 14:03
  • @Thi: it depends entirely on which shell you are using. I recommend using one of the several suggestions that have been made for SVN – Colin Fine Dec 02 '10 at 17:38
  • 5
    "Those who don't use a GUI for subversion are masochists." -- Masochism is to use subversion, but some of us have no choice. – Daniel Jan 27 '15 at 18:51

5 Answers5

162

You can use an svn changelist to keep track of a set of files that you want to commit together.

The linked page goes into lots of details, but here's an executive summary example:

$ svn changelist my-changelist mydir/dir1/file1.c mydir/dir2/myfile1.h
$ svn changelist my-changelist mydir/dir3/myfile3.c etc.
... (add all the files you want to commit together at your own rate)
$ svn commit -m"log msg" --changelist my-changelist
Mark Pim
  • 9,898
  • 7
  • 40
  • 59
  • It has a problem where u added a new folder and a file under that folder. When u add the folder to changelist, it shows "skipped". When u commit with the changelist, svn showed error E200009: '[folder you added]' is not known to exist in the repository and is not part of the commit, yet its child '[file you added]'' is part of the commit. – Andy Wang Sep 27 '20 at 13:03
32

You can use --targets ARG option where ARG is the name of textfile containing the targets for commit.

svn ci --targets myfiles.txt -m "another commit"
Dmitry Yudakov
  • 15,364
  • 4
  • 49
  • 53
  • Works for me in this bash command: `find . -name \*my.mask | xargs svn ci -m"message" --targets -` – ASten Jan 27 '16 at 09:31
30

I've had no issues committing a few files like this:

svn commit fileDir1/ fileDir2/ -m "updated!"
psy
  • 2,791
  • 26
  • 26
  • This is not working for me. Getting error "svn: '/' is not a working copy". Here I have posted my question, you can look. http://askubuntu.com/questions/442742/how-to-update-dir-on-svn-server/442751?noredirect=1#442751 –  Apr 03 '14 at 07:43
  • Yes worked nice. Also within my document root i could commit all changes within the working copy tree structure with this: >svn commit . -m 'mass commit message' – Grigoreas P. Jul 25 '17 at 10:36
  • Works also with files, not only folders :) thanks – Pierre Mar 03 '23 at 11:38
3

Use a changeset. You can add as many files as you like to the changeset, all at once, or over several commands; and then commit them all in one go.

Colin Fine
  • 3,334
  • 1
  • 20
  • 32
  • 1
    http://svnbook.red-bean.com/en/1.6/svn.advanced.changelists.html -- The svn keyword is "changelist", which is addressed in the first answer and most upvoted. – John W. Clark May 21 '15 at 20:05
1

Same as the answer by Dmitry Yudakov, but without an intermediate file, using process substitution:

svn commit --targets <(echo -e "MyFile1.txt\nMyFile2.txt\n")
Adrian B.
  • 154
  • 1
  • 11
  • 1
    For me on FreeBSD this worked only when `-e` added, e.g. `svn commit -m "new version" --targets <(echo -e "file1.ext\nfile2.ext\n")`. Not sure if this is FreeBSD-specific effect or not. – AntonioK Jul 01 '23 at 16:53