SVN status with ignore

Posted under » Version Control on 16 July 2019

SVN status is usefull but sometimes it can get clutterred. Delete what you don't want to see.

It's quite convenient to SVN ADD use wildcards (*) but There are times you regret adding a folder. To cancel an "svn add example_folder" command before committing to the repository, do not use svn delete or svn remove or made-up stuff like undo or cancel. Use the svn revert command:

svn revert --recursive example_folder

If you already committed but you want to ignore it, then delete it with a --keep-local option.

svn delete --keep-local example_folder

Read more about deleting multiple files.

Try some of this.

svn status -u
svn status -q
svn status -u | grep M

Ignore some directories and files. How this works is that you use the command svn propset to set the property svn:ignore on a particular directory. You give svn:ignore a value, which is a file name pattern. Then, svn will ignore all items in this directory whose name matches the pattern. Eg.

svn propset svn:ignore *.class ./cache/tmp
More ignore info.

Here, you’re telling svn to set the svn:ignore property, and what you want ignored are all files in the current directory (.)/cache/tmp with the extension .class.

If you want svn status to tell you about the ignored files as well, you can do:

svn status --no-ignore

A short note that when specifying a directory to be ignored, you must not put any slashes before or after it! To ignore the directory “bin”, just type “bin”.

svn propset svn:ignore bin . # yes
svn propset svn:ignore /bin . # noh
svn propset svn:ignore bin/ . # noh

So, that was simple enough right? However, the command we used above only sets svn:ignore for the current directory: svn will not ignore *.class files in subdirectories! Fortunately, if we want *.class to be ignored in all subdirectories as well, we just need to add the -R (or --recursive ) flag to specify that the command should be applied recursively:

svn propset svn:ignore -R *.class .
svn propset svn:ignore -R *.apk .

However above will not work. You will need to do this or just one line without >

svn propset svn:ignore -R "*.class
> *.apk
> Thumbs.db" .

If you’re working on a team, you can share your awesome svn:ignore settings with everyone else if you use the -F ( --file ) flag. With -F , you can specify a file that contains a list of file name patterns to ignore. For example,

bin
gen
proguard
.classpath
.project
local.properties
Thumbs.db
*.apk
*.ap_
*.class
*.dex

Save this file as .svnignore and

svn propset svn:ignore -R -F .svnignore .

Starting from the current directory, it recursively set svn:ignore with all of the patterns listed in .svnignore for each directory.

You can commit .svnignore to your repository so that you and/or your team can use it again it the future.

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data