This command will add any un-versioned files listed in svn st command output to subversion.

Note that any filenames containing whitespace in the svn stat output will not be added. Further, odd behavior might occur if any filenames contain '?'s.

svn st | grep ? | tr -s ' ' | cut -d ' ' -f 2 | xargs svn add

or if you are good at awk:

svn st | grep ? | awk '{print $2}' | xargs svn add

Explanation:

Step 1: svn st command

[user@xxx rails]$svn st
? app/controllers/application.rb
M app/views/layouts/application.html.erb
? config/database.yml

Step 2: We grep the un-versioned file with grep command:

[user@xxx rails]$svn st | grep ?
? app/controllers/application.rb
? config/database.yml

Step 3: Then remove the squeeze the space between ? and file path by using tr command:

[user@xxx rails]$svn st | grep ? | tr -s ' '
? app/controllers/application.rb
? config/database.yml
</pre>

Step 4: Then select second column from the output by using cut command:

[user@xxx rails]$svn st | grep ? | tr -s ' ' | cut -d ' ' -f 2
app/controllers/application.rb
config/database.yml

Step 5: Finally, passing these file paths as standard input to svn add command:

[user@xxx rails]$svn st | grep ? | tr -s ' ' | cut -d ' ' -f 2 | xargs svn add
A app/controllers/application.rb
A config/database.yml

 

How to use “svn add” recursively in Linux shell?的更多相关文章

  1. SVN的Windows和Linux客户端操作详解

    SVN的Windows和Linux客户端操作详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.Windows客户端操作 1.安装SVN客户端 a>.去官网下载svn软件 ...

  2. svn add 添加到版本库

    转 svn add-添加到版本库 常用操作1.添加一个文件到工作拷贝:$ svn add foo.c 2.当添加一个目录,svn add缺省的行为方式是递归的:$ svn add testdir 3. ...

  3. 苹果IOS系统SVN命令 同样适用于linux系统

    1.将文件checkout到本地目录svn checkout path(path是服务器上的目录)例如:svn checkout svn://192.168.1.1/pro/domain简写:svn ...

  4. 一次向svn中增加所有新增文件 svn add all new files

    svn st | grep '^\?' | tr '^\?' ' ' | sed 's/[ ]*//' | sed 's/[ ]/\\ /g' | xargs svn add

  5. svn add后的数据如何取消-svn revert??--zz

    svn add后的数据如何取消-svn revert?? 有时候你发现svn add后,这个提交的数据又不需要了.这时候需要有svn revert来处理了. 原文链接:http://hi.baidu. ...

  6. Linux(以RHEL7为例)下添加工作区的方法|| The Way To Add Workspace On Linux

    Linux(以RHEL7为例)下添加工作区的方法 The Way To Add Workspace On Linux 作者:钟凤山(子敬叔叔) 编写时间:2017年5月11日星期四 需求:有时候在使用 ...

  7. svn add @2x image 文件

    svn add `svn status . | grep "^?" | awk '{print $2"@"}'`

  8. svn add --no-ignore

    提交新代码时:svn add --no-ignore  /dir   不加的话可能会漏提交某些依赖或文件. Svn st -q --no-ignore. 提交时不需要加

  9. svn add xxx.txt 提示A (bin) xxx.txt

    [root@NGINX-APACHE-SVN iptables]# svn ci -m "add iptables.txt" Adding (bin) iptables/iptab ...

随机推荐

  1. 高频交易策略[z]

    Market Order以最高速下市价单(market order)是买方最基本的策略 Looking for Price Discrepancies 这个就是高频统计套利(high frequenc ...

  2. 【转】C++11常用特性的使用经验总结

    出处 http://www.cnblogs.com/feng-sc C++11已经出来很久了,网上也早有很多优秀的C++11新特性的总结文章,在编写本博客之前,博主在工作和学习中学到的关于C++11方 ...

  3. Java 测试URL地址是否能正常连接

    public static int testWsdlConnection(String address) throws Exception { int status = 404; try { URL ...

  4. Linux 批量替换文件名

    find -name "*parsed" |awk  '{print $1}' |xargs -i{}  mv {} {}.44

  5. UVALive 5009 Error Curves 三分

    //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include& ...

  6. Python学习笔记异常

    在程序代码中,可能会有各种错误的情况出现,且产生错误的结果是后面的代码都无法执行,即使是一点无关紧要的错误,如图: 在这样的情况下,我们需要异常处理,对程序代码中的错误抛出异常信息,且不影响后面的代码 ...

  7. App lifecycle(UWP深入学习一)

    https://msdn.microsoft.com/en-us/library/windows/desktop/br211474.aspx Launching, resuming, and back ...

  8. 用函数datepart获取当前日期、周数、季度

    用函数datepart处理就可以了,示例:select datepart(weekday,getdate()) as 周内的第几日select datepart(week,getdate()) as ...

  9. module中build.gradle文件参数含义

    主要是module的build.gradle,截图如下: 01行:apply plugin: 'com.android.application'    表示该module是这个应用程序的module ...

  10. (转)windows下安装nodejs及框架express

    转自:http://jingyan.baidu.com/article/456c463b60fb380a583144a9.html windows下安装nodejs及框架express nodejs从 ...