svn add all files except ignored files, svn del all missing files at once

To schedule all files and directories in your working copy for addition to the repository recursively, you can do it like below.

$ svn add * --force

Because svn add * can't add files which are not under version control yet in directories which are under version control, --force is needed. But in this case ignored files and directories in current directory are also added.
It also attempts to add files under version control, so many warnings show. It's ugly.

At last I found out there is no good way as long as I am using svn only.

To add all files except ignored files and delete all missing files at once, you can create an alias which filters output of svn status using grep and replaces it using sed like below.

~/.bashrc

alias svndel="svn st | grep '^!' | sed -e 's/\![ ]*/svn del /g' | sh"
alias svnadd="svn st | grep '^?' | sed -e 's/\?[ ]*/svn add /g' | sh"

It's very convenient!

Source: svn に登録されていないファイルをまとめて svn add:Goodpic
svn addがめんどくさいので | firegoby

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.