grayside / grunt-staged

Run grunt tasks with only those source files staged for code commit.
MIT License
0 stars 0 forks source link

Getting an error when trying to fix merge conflicts and commit when using grunt-staged + grunt-githooks #1

Open davereynolds opened 9 years ago

davereynolds commented 9 years ago

What I am trying to do:

Merge a branch (master) into my feature branch, manually resolve merge conflicts and then commit the result.

The error I get on commit:

fatal: could not open '.git/MERGE_HEAD' for reading: No such file or directory

What seems to be happening:

I'm running grunt-githooks with a pre-commit hook that tests all staged files using grunt-staged. Since grunt-staged is doing a git stash in the background, it seems that MERGE_HEAD is getting stashed and subsequently git can't compare/know if the merge is successful.

Here is a description of how git stash and MERGE_HEAD interact:

http://stackoverflow.com/questions/9009354/git-stash-during-a-merge-conflict

Here is how someone else worked around this issue:

https://github.com/brigade/overcommit/commit/6c5a7b7ab92c6bbe4e1a9d874762b7b50a920593

grayside commented 8 years ago

Sorry I missed this for so long @davereynolds. The specific technique used to compute staged files is undertaken in the library staged-git-files. I'll look into whether this can be fixed upstream or via a different library.