As git is a distributed version control system, it depends on which trust model you use.
As you and they have probably both changed master in this case and you are both (probably) doing git pull origin master
. When you do this (or the git fetch
and git merge
that it actually comprises of) you are basically saying that you trust any changes that other people have made, i.e. other people who have been given access to write to the repository.
So this is probably where you are today.
I would recommend you consider doing an interactive rebase (e.g. git rebase -i HEAD~10
) which would also let you simply delete commits ot of the history. I say this rather than just undoing the last commit because you'll need to commit your changes, and pull his which will now be older commits and harder to reach. But use rebase interactive with great caution. I recommend you back the entire project up to another directory when learning to do such things. Examine the results carefully before committing and pushing them.
There are lots of options going forward so that it doesn't happen again, here are some:
For more info on your options, please see the fetch merge and rebase options in:
git branch, fork, fetch, merge, rebase and clone, what are the differences?