Вопрос

I understand the purpose of git fetch but I don't get why someone want to continuously update his local repo without merging. I mean when you are ready you can just do a git pull. Why do git fetch followed by git merge in increments ?

Это было полезно?

Решение

git fetch gives you a full copy of the remote's history, allowing you do to pretty much instant diffing and things like that. Suppose you're working on a complex change on a topic branch while the main branch keeps getting updated. You don't want to merge all the time because merges are a lot of work, but you do want to be aware of what's going on in the main branch so you can anticipate (and perhaps even prevent) extra work. If you have the history available locally, it shows up in all your visualization tools (e.g. gitk --all); personally I don't think looking at Gitweb or Github interfaces all the time really compares.

And, of course, the big benefit to doing fetch/merge separately is so you can see whether the changes on the other branch are actually worth merging.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top