LoginSignup
0
0

More than 3 years have passed since last update.

他の人がpushしてくれたブランチをベースに開発を進めたい時

Posted at

はじめに

例えば作業者Aと作業者Bが一緒に作業してて作業者Aの人がfeature/create_user_tableブランチを切ってpush(このタイミングでリモートブランチが作成されます)して、このブランチをベースに作業してくれって言われた時に作業者Bの人がそのブランチの修正をローカルに持ってくる方法

やること

リモートブランチの一覧を以下コマンドで見る。

$ git branch -a

この時、チェックアウトしたいブランチが表示されていない時は、git fetchすると最新のリモートブランチの情報を取得できたりする。

$ git fetch
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 10 (delta 5), reused 8 (delta 4), pack-reused 0
Unpacking objects: 100% (10/10), 2.22 KiB | 252.00 KiB/s, done.
From github.com:***/***
 * [new branch]      feture/create_user_table -> origin/feture/create_user_table

なんかこんな感じのが出ればオッケーです。

後は、これをベースにローカルブランチを作成。
git checkout -b ローカルブランチ リモートブランチ

今回の場合ならこれでいけます!

$ git checkout -b feture/create_user_table origin/feture/create_user_table

これでgit logで修正履歴を確認した時にorigin/feture/create_user_tableの修正が反映されてるのが確認できればオッケーです!

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