0

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

jlewkovich
  • 2,725
  • 2
  • 35
  • 49
  • 1
    Is there any downside to just invoking the appropriate git commands directly? – David Neiss Aug 02 '16 at 15:15
  • @DavidN To me, that is a manual process I'd like to avoid, especially when new, less experienced developers join the team and may be more careless...however, if it's the best option available, that's the path I'll take – jlewkovich Aug 02 '16 at 17:46
  • @DavidN Unless you're suggesting there's a way to add a grunt task for invoking a git command, then that will probably work – jlewkovich Aug 02 '16 at 17:46

1 Answers1

1

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.

jlewkovich
  • 2,725
  • 2
  • 35
  • 49