0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gitの流れ(情報取得まで)

Posted at

GitHubから情報を取得するまでの流れ#

リモートの情報確認する方法##

git remote
このコマンドでリモート名を表示する事ができる。

対応するURLを確認する場合このコマンドに**-v**を加える事で見る事ができる。

git remote -v

今回の場合このように表示されます。↓

origin URL(fetch)
origin URL(pull)

このfetchpullとは何でしょう。次にこれらを見ていきます。

fetchとpushについて##

git fetch
git pull

これらはリモートから情報を取得するコマンド

なぜ二つあるのでしょうか?それぞれ見てみましょう。

fetch###

fetchを使う事でリモートリポジトリからローカルリポジトリに情報を流して来てくれます。

その後git mergeというコマンドでワークツリーに情報を流します。

使い方はこちら↓

git fetch リモート名

pull###

pullを使う事でリモートから一気に情報を取得する事が可能になりました。

使い方はこちら↓

git pull リモート名 ブランチ名

or

git pull

これ見てる限りだとpullの方が便利じゃねと思いますが、次にpullのメリット・デメリットについてみていきましょう。

pullのメリット###

・慣れれば一気にできるので便利

pullのデメリット###

masterが二つ以上ある場合、管理がしっかりできない(自分がどこのブランチにいるかの確認)と片方のブランチにもう片方のブランチをマージしてしまう恐れがある。

おすすめとして、慣れるまではfetchを使った方がいいです。

次でgitは最後になります。
次回は細かなところまで見ていきます。

第一回(コミットまで)[https://qiita.com/juki1007/items/e45f8f753a01d9788015]

第二回(pushまで)[https://qiita.com/juki1007/items/61d5a9eb985be9d75323]

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?