How commit all files except one with SVN

I want to commit all modified files except one using Subversion.

So here is the scenario:

  • Git alias with positional parameters
  • How to enter command with password for git pull?
  • What is the git command to erase all changes and revert to the state of your last commit?
  • How To Launch Git Bash from DOS Command Line?
  • git alias to delete local and remote
  • “Git Log” command in Powershell - unable to terminate process
  • $ svn st
    M    file1
    M    file2
    M    file3
    M    file4

    I can do something like this:

    svn ci -m "Commit 1" file1 file2 file3
    svn ci -m "Commit 2" file4

    But when a large number of files, I’m trying to simplify my work:

    svn ci -m "Commit 1" `svn st | awk '{print $2}' | grep -v file4`
    svn ci -m "Commit 2" file4

    This solution is very fragile, because with this scenario not works:

    $ svn st
    M    file1
    M    file2
    D    file3
    A +  file4

    I think that SVN does not have a built-in solution for my problem, but I not sure. Any other approach?

  • git filter-branch --msg-filter to reword a pushed commit message
  • Commit without changes
  • Getting error trying to commit using Subversion on Mac OS X
  • git commit - how can I see the changes that were made while doing a commit
  • Can I delete a commit in Subversion?
  • How to edit log message already committed in Subversion?
  • 6 Solutions collect form web for “How commit all files except one with SVN”

    Option 1, AWK:

    svn ci -m "Commit 1" `svn st | awk '{print $NF}' | grep -v file4`
    svn ci -m "Commit 2" file4

    Option 2, –targets:

    svn ci -m "Commit 1" --targets filesToCommit.txt
    svn ci -m "Commit 2" file4

    Option 3, –changelist:

    svn changelist my-changelist file1 file2 file3
    svn ci -m "Commit 1" --changelist my-changelist
    svn ci -m "Commit 2" file4

    You can do it like this:

    svn diff file4 > tmp.patch
    svn revert file4
    svn ci -m "Commit 1"
    svn patch tmp.patch

    At this point all files are commited except file4

    You can somewhat improve on your approach by adding your files with a script to a change list and committing it. You can inspect the list to make sure that it contains the right items before committing.

    See svn changelist --help and --changelist option in svn ci --help.

    Commiting all except one using changelists:

    svn changelist my-list -R .
    svn changelist --remove file4
    svn ci -m "Commit 1" --changelist my-list
    svn ci -m "Commit 2" file4

    Although I’m sure you could work out a solution like you propose using a more complex awk command line, since we’re talking about just one file, why not

    1. Copy the file to a temporary location
    2. svn revert the modified file to get the original back
    3. Commit the whole repository
    4. Copy the modified file back

    Simple, easy, fast.

    Just commit filtered list of files.

    svn ci `ls | grep -v file4`
    Git Baby is a git and github fan, let's start git clone.