简体   繁体   中英

Understanding git pull and git fetch

I understand that git fetch downloads the data from the remote repository and only updates the remote-tracking branches, not yet merging into the local branches (thic can be done with git merge local_branch origin/remote_branch ). And that git pull does all of this at once.

But I want to know: do both of these command download a single branch? Or do they download the entire remote repository (and in the case of git pull , merge it) at once?

git fetch fetches all branches and tags from the remote repository (but as you say, it does not merge the changes into local branches).

git pull does this fetch (of all branches and tags) and then merges only the current branch .

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