Is it correct to say that «pull» is kinda «merge»?

2019-07-31 08:39发布

Is it correct to say that «push» is kinda «merge»? The only difference, that I see: «merge» is operation on my local branches, «push» is operation between local and remote branch.

Is my understanding right or not?

2条回答
Melony?
2楼-- · 2019-07-31 08:56

git pull is an alias to git fetch + git merge.

git fetch updates your local repository with the changes (delta) which are downloaded from the remote repository and stored inside your local .git folder.

Once the fetch is over and you have all the data locally, then git merge occurs and merges your changes with the one from the remote.


enter image description here


enter image description here

查看更多
再贱就再见
3楼-- · 2019-07-31 09:07

git pull is defined as git fetch + git merge. So yes, it is merge.

git push is not a merge of any kind. It just pushes your local commits to a remote destination. If anything goes less than perfect, it refuses to continue.

查看更多
登录 后发表回答