Why does git create a merge? And how to remove them?

An employee has been working on a function for several weeks, and now git comments:

colleag add class 8b5bec5 colleag add change 3535adc5 colleag Merge branch 'NEW' of github.example.de:example/app into NEW 0cc2d24 colleag add change colleag add validation 7eff440 colleag rebase done wrong merge f8e35e3 colleag Merge branch 'NEW' of github.example.de:example/app into NEW 2168ac6 colleag wrong merge a6ed636 colleag typo in spec 7b23633 

I think he does:

 git pull origin master 

on its working branch.

So my questions are:

1) What does this mean:

 Merge branch 'NEW' of github.example.de:example/app into NEW 2168ac6 

This merge merge, but why does git merge with the remote here?

2) Is it possible to clear these mergers? Currently I am collecting cherries, but I'm not sure if this is the best.

What else can you advise after reading git log?

+6
source share
1 answer

These commits are related to the fact that your colleague did some work in his local branch, and then pulled out new commits from the remote control. The key is that git pull is a combination of the two git commands, git fetch and git merge . As a rule, these commits are quite harmless, but in my experience they sometimes cause some problems.

The end can be avoided by running git pull --rebase origin master . This makes extrusion a combination of git fetch and git rebase . This will cancel the local commits and commit to the remote control, then apply the local commits one at a time. As for the commits that you already have on your remote, you can try to clear them with an interactive reinstall, but this will cause more problems than it's worth. I would just try to change the workflow of co-organizers and leave them on the remote control. Changing the overall story is risky and can be a painful process.

I wouldn’t become a cherry - take a comment if you just take for yourself that your colleague was fine with you. Although I usually prefer merging branches instead of trying to make cherry picks, as this leads to fixations that have the same patch with different sha and can lead to merging branches to be harder than it should be.

+16
source

Source: https://habr.com/ru/post/955021/


All Articles