what does git merge origin/master do?

前端 未结 2 1466
眼角桃花
眼角桃花 2021-01-31 04:01

After fetching from remote using git fetch, we need to use something like

git merge origin/master

I would like to know if this com

2条回答
  •  北海茫月
    2021-01-31 04:49

    What this does is merges the branch referred to as origin/master into your current branch. The order is very important. The word origin means the place from which you cloned your repository, i.e., the origin of the repository, the word master is just a branch name, however master is usually used as the main branch, or the trunk branch as some other systems call it.

    Merge might need to do a commit depending on the state of your development. If your history hasn't diverged from the origin, it can do what is called a fast-forward---all that needs to be done is put the new history on top of yours. If your development has diverged from the origin then if the merge can be done with no conflicts then the merge is done and a new commit is recorded at HEAD to specify the merge and the two parents.

    Furthermore, if merging can't be done because of a conflict, your working copy is updated to reflect the fact that there are conflicts, then when you fix them, you manually make the commit that records the merge.

提交回复
热议问题