Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN: How to ignore a modified file on commit? [duplicate]

Tags:

svn

I edited some files in svn, like this:

$svn st
M  a
M  b
...

Now, I want to commit my changes to svn, for some reason, I don't want to commit file b, is there any quick way or command to ignore the modified file b?


Finally, I use @yzucker Solution 1, cp, revert and commit. Changelists is too heavy, thank you all.

like image 981
fannheyward Avatar asked Dec 27 '11 11:12

fannheyward


People also ask

How do I ignore a file in svn?

Use the following command to create a list not under version control files. Then edit the file to leave just the files you want actually to ignore. Then use this one to ignore the files listed in the file: svn propset svn:ignore -F ignoring.

How remove file from svn commit?

To remove a file from a Subversion repository, change to the directory with its working copy and run the following command: svn delete file… Similarly, to remove a directory and all files that are in it, type: svn delete directory…


2 Answers

You can use the Changelist Feature of newer Subverion clients as shown in this short example session:

$ svn st
M       a
M       b

$ svn cl task1 a
$ svn cl task2 b

$ svn st
--- Changelist 'task1':
M       a
--- Changelist 'task2':
M       b

$ svn ci --cl task1 -m "checking in only task 1 stuff"
Sending        a
Committed revision 11.
like image 61
A.H. Avatar answered Sep 22 '22 14:09

A.H.


Alas, the commit many files with some annoying changes ignored problem.

Solution 1: copy, revert and commit

$cp b /tmp/
$svn revert b
$svn commit -m 'commit message'
$mv /tmp/b ./

Solution 2: copy, commit, reverse the effect of b, recommit b

$cp b /tmp/
$svn commit -m 'commit message'
$svn merge -c -{new revision} b
$svn commit b -m 'revert message for b'
$cp /tmp/b ./b

The second approach is less preferable since you introduce broken code in svn.

like image 39
yzucker Avatar answered Sep 21 '22 14:09

yzucker