LoginSignup
4
5

More than 5 years have passed since last update.

備忘録としてのgit/hubを使った基本的なワークフロー

Last updated at Posted at 2016-10-26

複数人でプロジェクトに関わる際には欠かせないgithubですが自分が行っている簡単な手順を備忘録として載せておこうと思います。本格的に使い始めて数ヶ月何かフィードバックがあればその都度改善していこうと思います!

作業開始

  • ブランチを切る
  • publish

作業中

  • 時々コミットしてsaveとマスターとの同期を行っておくとトラブル発生時に対処しやすい。

作業後

  • マスター画面に移って同期
  • ブランチ画面に戻ってcommit
  • update to masterでマスターから持ってきた変更をブランチに反映させる。
  • 変更点を確認。赤は行の削除、黄色はマスターとブランチの変更にコンフリクトがあった場合
  1. 両方を残す場合:
<<<HEAD ======== 
>>>MASTER

で囲まれた部分を削除

  1. 同じ部分を変更していた場合: 一言を声をかけて変更点に意見の相違がないかを確認。
  • コミット
  • pull request

公式サイトのResolving a merge conflict using the command lineより:

To see the beginning of the merge conflict in your file, search the file for the conflict marker <<<<<<<. When you open the file in your text editor, you'll see the changes from the HEAD or base branch after the line <<<<<<< HEAD. Next, you'll see =======, which divides your changes from the changes in the other branch, followed by >>>>>>> BRANCH-NAME. In this example, one person wrote "open an issue" in the base or HEAD branch and another person wrote "ask your question in IRC" in the compare branch or branch-a.

If you have questions, please
<<<<<<< HEAD
open an issue
=======
ask your question in IRC.
>>>>>>> branch-a

Decide if you want to keep only your branch's changes, keep only the other branch's changes, or make a brand new change, which may incorporate changes from both branches. Delete the conflict markers <<<<<<<, =======, >>>>>>> and make the changes you want in the final merge. In this example, both changes are incorporated into the final merge:

Review後に変更点を加えて再度commitするときは

  • 変更点を加える
  • commit

その他役に立ちそうなリンク

Git 作業における commit と push の頻度について
commitとpushする意義やタイミングはチームによって異なると思いますが、一つの例として記載されているので参考になるかと思います。

4
5
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
4
5