Home > database >  Why does Git pushes files I resolved when pulling?
Why does Git pushes files I resolved when pulling?

Time:08-04

I just 'git pull' to receive the latest version of the files from the remote repo, and some newer files created conflicts that I had to resolve. In all conflicts I chose to accept the remote repo version so those files are exactly the same as the remote.

Now I would like to push the repo because of changes made to another file, but Git pushes all the files that had conflicts even though they are exactly the same as the remote repo. Why does it happen? Is there a way to avoid this?

CodePudding user response:

Even if you accepted the remote version you still created a merge commit which basically contains the information that the changes you made are integrated in the branch. The merge commit will have two parents: the commit you pulled and your local one.

This new commit needs pushing.

You'll see the commit when you inspect the log using git log or your preferred visual tool for inspecting the commit history.

CodePudding user response:

if you haven't setup rebase=true in .gitconfig

please setup it like this

[pull] rebase = true

When you have conflicts you should resolve it and force push it. git push -f

  • Related