Git is not showing any conflicts, and is overwriting my local copy

My routine on git has always been very simple:

git add -A
git commit -m 'the changes I made'
git pull
# resolve conflicts
git push

However, for some unknown reasons, despite lots of conflicts with the origin, after pulling, I don’t get any conflicts and without my permission it force updates my local copy. Something along these lines: ‘2 files changed, 2 insertions(+), 6 deletions(-)’. But in my case, conflicts shouldn’t be resolved from simple merge and should require manual conflict resolution from my side. Why is git not letting me to do the manual conflict resolution? Thanks in advance!
note: none of my git commands have force option -f

  • How do I move a Git branch out into its own repository?
  • How do I make this shorter in my terminal?
  • Visual Studio 2015 using Git unable to compare files
  • creating branch just for merge
  • Using git for approval process?
  • SourceTree wants to commit unaltered files
  • Abort a Git Merge
  • hg-git clone from Github gives “abort: repository is unrelated”
  • To put the prefix ?<revision-number> to codes by Git/Svn
  • Determining how cvs2git converted CVS trees
  • Add a new Project to GitHub via Bash command?
  • git recover single file that was deleted during a merge
  • 2 Solutions collect form web for “Git is not showing any conflicts, and is overwriting my local copy”

    git pull without argument is, more or less, equivalent to git fetch && git merge origin/<upstream_branch>. By using pull instead of fetch and merge, you’re allowing git to attempt the merge into your local branch. If that merge occurs without conflict, your local will look “force updated” because it was able to sort out the differences between the remote’s version of your files and your own, without your intervention.

    Debugging what’s happening is sort of hard without seeing your code, but try this:

    git fetch ;# fetch the remote changes
    git diff HEAD origin/<branch> ;# diff your local branch with the remote's copy of <branch>
    

    The output from git diff should clue you into what’s happening. If you’d like to follow it even further, try git merge --no-commit origin/<branch>, then issue git diff --cached. That’ll show you exactly what changes git merged automatically, and should allow you to determine what’s what.

    If git manages to resolve all the conflicts during a git pull then it will make a commit. This doesn’t mean that it necessarily got things right. As you’ve noticed, depending on the changes you may need to do some manual fix-ups.

    To do this, make the corrections in your working tree after your pull, then stage them (e.g. with git add -u) and amend the merge commit with git commit --amend.

    This will make a new merge commit which replaces the one that git made with one including your corrections.

    You can then push the results as you usually do.

    Git Baby is a git and github fan, let's start git clone.