git pullとgit fetchの違いって何?Stack Overflow和訳

HI!!
今日はStack Overflowの高評価の記事を和訳する。
質問者に7936、回答者に6615のいいねがついている。

質問

What are the differences between git pull and git fetch?

git pullとgit fetchの違いって何?

回答

In the simplest terms, git pull does a git fetch followed by a git merge.

簡単に言うと、git pullはgit fetchをしてからgit mergeするのと同じことだ。

You can do a git fetch at any time to update your remote-tracking branches under refs/remotes//.

git fetchでrefs/remotes/<remote>/の元にあるリモートブランチからいつでもアップデートできる。

This operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy.

これをしてもrefs/headsの元にあるローカルブランチを変更することがないし、ワーキングツリーが変更することもないので安全である。

I have even heard of people running git fetch periodically in a cron job in the background (although I wouldn’t recommend doing this).

定期的にcron jobでgit fetchを走らせている人もいるらしい。(まあ、このやり方はおすすめしないけど..)

A git pull is what you would do to bring a local branch up-to-date with its remote version.

git pullはリモートブランチをローカルに落とし込む(アップデートする)ことができる。

終わり

やっぱり、初心者向けで優しい記事が高評価を得るんだね!
see you!!

リンク

stackoverflow.com