Could you please help me. I have some problems with git pull. When I try to do a git pull I see new commit every time:
Merge branch 'prod' of https://github.com/frontend into prod
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
enter image description here enter image description here
I merged dev branch into prod through GitHub PR. This problem is only on my computer, the git pull works correctly on other computers (without conflicts with the same branches). Committing the merge changes results in an extra commit.
Why might this be happening? How can I make sure that changes are pooled without conflicts and an extra commit does not appear?
I have tried updating all branches to the same state. But as soon as someone from the team pushes their changes into the branch, or merges the PR, then I cannot pull the changes, I have conflicts, although the branch has not changed. To avoid this problem, I have to delete the local branch every time and pull again from the origin.
For example, I delete the local branch git branch -D example-branch
, then git fetch
, and pull the branch from origin/example-branch
. I have a local example-branch
branch synced. I create a new branch example-new
from exapmle-branch
, make changes and commit. I create a PR from exapmle-new
to exapmle-branch
and merge it. I go to the local branch exapmle-branch
, do a git pull
and get a message with conflicts. I open a commit with conflicts and it's just the contents of my commit. There are no conflicts as such, the commit is simply duplicated and requires pushing it back. This happens every time. If I repeat this procedure on another computer, then this problem does not exist.
@quetzalcoatl, @AD7six, thank you very much for your detailed answers! It's working! =)
It helps me:
git config pull.ff true
git config --global pull.ff true