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. apache端口的修改

    apache 这个web服务默认在80端口监听...如果你访问一个网站 http://www.baidu.com  则默认一个端口是80 1.      一台机器可以有 1-65535 号端口 2.  ...

  2. 更换光纤后路由器端口映射 -VPN相关

    之前一直是ADSL的线路,使用路由器后,很简单就可以实现端口映射了!外网也可以随意连接,可是最近升级宽带更换了光纤后,发现怎么都不能正常工作了!在光纤猫里显示的IP居然是:10.0.*.*,查询到的外 ...

  3. Android 3D滑动菜单完全解析,实现推拉门式的立体特效

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/10471245 在上一篇文章中,我们学习了Camera的基本用法,并借助它们编写了一 ...

  4. 去除html标签 正则表达式

    /// <summary>        /// 去除html标签        /// </summary>        public static string Clea ...

  5. Mac mysql修改密码

    在网上看了很多的办法,其实解决办法都对,只是没有说明白: 1,首先启动mysql服务 2,mysqladmin -uroot -p 'newpassword' 此时需要输入登陆密码(数据库的密码,刚安 ...

  6. linux(ubuntu)安装时遇到的问题

    window环境下安装linux虚拟机=时,由于在初始系统语言选择了中文,当linux虚拟机安装成功后, 按[Ctrl + alt +f1~f6]任一一键都行,进入到命令行模式,这时你会发现,哎,我的 ...

  7. elasticsearch-索引

    1.创建新索引 PUT:http://localhost:9200/twitter { "settings" : { "number_of_shards" : ...

  8. [Leetcode][JAVA] Best Time to Buy and Sell Stock I, II, III

    Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a gi ...

  9. 11-30 k线图demo中学到的零散知识

    1. 使用NSObject类的方法performSelectorInBackground:withObject:来创建一个线程. 具体的代码: [Object performSelectorInBac ...

  10. 在jsp中常用的内置对象(5个)小总结和两种页面跳转方式(服务器端调转、客户端跳转)的区别

    jsp中常用的几个内置对象: 一.request对象 主要作用:  (1)获取请求页面的信息   比如:request.getParameter("参数名");  (2)获取客户端 ...