Powershell script that can reset all blank/new line diffs at once

A few months ago I created scripts that can take all database module into script such as table scripts, stored procedure, views. It could get all database changes be trackable.

But this scripts has a small issues which output new blank or new line at when it works. I couldn't end up find out the root so that I created new scripts that can reset these new blank or new line. It's going to be OK if new blank and new line are removed!

Reset script is like this;

$diffs = git diff --stat-width=800 -w --ignore-blank-lines
foreach($diff in $diffs){
    if($diff -match "\|\s+0"){
        $diff -match "\S+"
        $filename = $matches[0]
        git checkout $filename
        echo "Reset $filename"
    }
}

git diff can't do for several diffs at once, so I use for to process each files.

AUTHOR

Thank you for your first article. I'm looking forward to sharing your knowledge.

READ NEXT

Boostlog is an online community for developers
who want to share ideas and grow each other.

Delete an article

Deleted articles are gone forever. Are you sure?