server
server copied to clipboard
pre-commit-hooks moves changes into other changelist
Not sure if this is a general issue or due to our configuration, but everytime I commit, or try to commit I have to sort my files back into their changelists. I have made changes and sorted them into multiple changelists. Every time the pre commit hooks run all my changed files are put in the active changelist and I have to move them back manually which is annoying as hell.
I’m not quite sure what you mean by “changelist”. I also haven’t tried out the pre-commit hooks, I just made sure they installed before merging the PR from @Gatsik.
I just learned that it is an Intellij feature and it is not a git feature. Basically it lets you split the indexed changes into logical subsets.
Now that we know that it is not a git feature, I am really wondering how the pre-commit feature can mess it up...
Huh weird. Well if it’s using the git index file somehow then maybe pre-commit it is messing with that.
I don't think this is the server issue, moreover, I don't think this is the pre-commit or Intellij IDEA issue either, it's just the way you work with the version control system. I think it happens because pre-commit stashes all the changes before running its checks, and at that moment Intellij thinks that work is done (probably, I have never used Intellij IDEA and changelists).
That indeed sounds like the stash is the issue. Seems like when stashing the changes, the information which changelist a change belongs to gets lost. Do pre-commit hooks always stash the changes, or is that based on how they are configured? I'll try to find more information on the internet, because if this is a general issue there must be others with the problem too (and hopefully some solutions).
Yes, pre-commit always stashes the changes (link)