I am working in a project with three more collaborators, my case is:
Every time I try to add a new commit and there is some change in the remote (even though it is a file that I have not worked in local), I get the following message that forces me to create a merge with following default message:
error: failed to push some refs to 'https://work.git.beanstalkapp.com/app.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
This scenario is only avoided if there are no changes in the remote.
This causes many commits that look like Merge branch 'master' of https://work.git.beanstalkapp.com/app
in the commit history, and I want to avoid that.
I found a related question, for some people using git push -f origin master
is working but using --force
worry me. I do not want to damage the project.
How can I achieve that?