I have repository on GitHub to which I commit regularly from my local computer. On the other side I have server pulling from the repository. The web server just executes a git pull
in order to get the latest changes from the GitHub repository. This is completely automated and should stay that way (solutions like the Ruby Tool Capistrano are out).
A simple git pull
usually works just fine. However, sometimes I change the last commit (git commit --amend
) and git push
the changes twice to GitHub. If the server auto-updated it's code between the two pushes to GitHub, the next server side git pull
fails because there is merge conflict.
To solve this problem I need the following behavior: The server should continue to git pull
(or something equivalent) the GitHub repository but in case of a merge conflict, the GitHub repository should just take precedence over the local repository on the server. So, I want a git command that behaves like git clone
, but doesn't copy the whole repository every single time.