12

我正在和很多人一起开发。

我签出远程存储库,获取 3 个文件。编辑后运行:

svn status

表明:

M file_1
M file_2
M file_3

现在,我只想提交两个文件:file_1、file_2,而不是 file_3。

怎么做?

我不想用

svn revert file_3

在提交之前。

说明:我编辑 file_1,file_2 用于共享项目,file_3 仅在我的本地计算机上运行。

4

7 回答 7

12

扩展zoul的答案..来开发您的文件列表,请使用:

svn stat |  grep -v ignore.file | perl -ne 'chop; s/^.\s+//; print "$_ "'

或者,如果您有带空格的文件名,请使用:

svn stat |  grep -v ignore.file | perl -ne 'chop; s/^.\s+//; print "\"$_\" "'
于 2013-04-23T21:02:42.660 回答
9

怎么样:

$ svn commit file_1 file_2
于 2011-12-15T08:25:17.337 回答
3

bash 一行:

svn ci $(svn stat | grep -v exclude.file)
于 2015-04-06T07:32:44.460 回答
1

只需将要提交的文件的路径附加到 svn commit 命令:

svn commit file_1 file_2

http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.commit.html

于 2011-12-15T08:27:12.730 回答
1

我最终制作了一个包含以下内容的脚本:

svn ci $(svn diff --summarize | \
    grep -v exclude.file1 | \
    grep -v exclude.file2 | \
    ...
    grep -v exclude.fileN \
)

我相信有人可以通过让这个脚本读取一个包含要从提交中排除的文件列表的文件来使其更加灵活。

于 2015-10-08T20:17:06.423 回答
0

这是一个 windows powershell 版本,它只提交不在更改列表中的文件。创建一个名为 ignore-on-commit 的更改列表(Tortoise SVN 无论如何都会理解)并将您不想提交的文件放入其中。

# get list of changed files into targets
[XML]$svnStatus = svn st -q --xml C:\SourceCode\Monad
# select the nodes that aren't in a changelist
$fileList = $svnStatus.SelectNodes('/status/target/entry[wc-status/@item != "unversioned"]') | Foreach-Object {$_.path};
# create a temp file of targets
$fileListPath =  [IO.Path]::GetTempFileName();
$fileList | out-file $fileListPath -Encoding ASCII
# do the commit
svn commit --targets $fileListPath -m "Publish $version" --keep-changelists 
# remove the temp file
Remove-Item $filelistPath
于 2013-11-09T11:47:06.740 回答
0

也许你可以使用这个命令。

svn ci `svn st | grep -e "^[A|M]" | grep -v "test.js" | grep -ve "conf\.js$" | awk '{print $2}' | tr "\\n" " "`
于 2015-12-11T04:18:59.900 回答