简体   繁体   中英

Git Pull vs Git fetch Which one is Preferable?

I know the difference between git pull and git fetch .

but i want to know, Which one is Preferable?

because git pull doing merge automatically without my knowledge. thats the different i found. git fetch wont do that. is there anything else?

Contrary to the above comments, git pull and git fetch are not completely different commands. Rather, doing a git pull on a given branch is the same as doing a git fetch followed by either merging or rebasing the current branch on its remote counterpart which was just updated.

The utility of doing a git pull is that often the reason we fetch is to update a local branch with the version on the remote. So it is a bit of a convenience. We can always do fetch followed by merge separately.

git pull will do a git fetch and then a git merge . So it depends what do you want to do.

If you prefer to handle manually the merge you shouldn't use git pull

What is the difference between 'git pull' and 'git fetch'?

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