jlewkovich
jlewkovich

Reputation: 2775

Git reset or checkout specific file using Grunt

I have a grunt process that creates a deployment package, and it involves making changes to files that need to be present for deployment, but not checked into source.

I'm looking for an automated way to either reset individual files or checkout files from HEAD on the same branch (using grunt/git)

Some libraries I've looked into:

grunt-git: The gitcheckout and gitreset commands here only operate on branches themselves, not individual files

grunt-git-reset This seems to only utilize directories, which is better, but I still would like to specify individual files.

I can have developers manually revert files before pushing code, but that's not ideal

Upvotes: 0

Views: 228

Answers (1)

jlewkovich
jlewkovich

Reputation: 2775

Was able to solve this using grunt-shell:

shell: {
    resetFile: {
        command: 'git checkout test.html'
    }
}

Just add this to the end of your grunt task.

Upvotes: 1

Related Questions