I have a git setup with two repositories, both of which are read/write (I usually code on one, but sometimes I code on the other too). My workflow is typically that I do work on my local repo, and then when I'm ready to test my changes, I push my commits to the other remote repo where I actually build my project. For some reason, however, when I push from local to remote, the changes on the remote repository are "inverted", i.e. the repository is updated, but the inverse of the changes (i.e. the changes that would bring the remote repo back to its pre-pushed state) are registered in the index.
For example, say I have a file with a comment // This is a comment
that I've updated to say // This is a comment that has been updated
locally, and then pushed to my remote repo, I get the following on my remote repo:
remote_repo$ git diff --cached
-// This is a comment that has been updated
+// This is a comment
Obviously I can bring them into the same state by running git reset --hard
, but is there any other way to do this and/or automate it? I expect most people will suggest adding a post-receive hook that runs git reset --hard
, but I'm hoping this is configurable in a clean way.