简体   繁体   中英

git shows two master branches and merge commit of them

I committed "CRM.Auctions.Data 9.3 schemes support" and then my teammate pulled it and made his own commit "esProxy ip changed" but when we looked at the repository, we saw this picture:

回购

These two branches are shown both as master. Why did it go so?

I used GitExtensions and the other git client was VS Code embedded git client. I guess it occurred because VSCode client doesn't support fast-forward merges?

What you see is not "two master branches", it is "master" your local master branch and "origin/master", which is the local representation of the master branch on the "origin" remote. This is just because of your confusing title.

And D. Ben Knoble is right, you should have used git pull --rebase to avoid auto-merge when you used pull. From git manual:

git pull is shorthand for git fetch followed by git merge FETCH_HEAD.

You should always use:

git fetch origin

Before you pull, to see what is going to happen and do a:

git pull --rebase

In case of divergence.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM