Руководство по веткам (Git и Qt)

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск

Содержание

Руководство по созданию, сопровождению и закрытию веток

Это руководство поможет вам избежать создания целого леса веток разработки и адского слияния. Придерживайтесь простых правил и вы обнаружите, что поддерживать и объеденять отдельные строки кода - это просто.

Создание новой функциональной ветки

Когда создаётся новая ветка то, чтобы начать вы должны выбрать одну ветку за основу. Хорошей основой являются ветки:

  1. Стабильные
  2. Долгоживущие
  3. Сопровождения

Кроме того, вы можете захотеть сделать где-нибудь резервную копию вашей новой ветки, выберите расположение:

  1. Личный клон вашего проекта.
  2. Хранилище команды.

Обслуживание и обновление ветки

Практическое правило - пытайтесь тянуть обновление только из вашей базовой ветки. Избегайте вытягивания из эксперементальных веток в вашу функциональную ветку. Не вытягивайте другие ветки проекта в ващу функциональную ветку до тех пор пока вы не решите стать частью проекта.

Closing a branch

When you’re done with your feature, decide where to merge it back. Your options include:

  1. The most straightforward target is your base branch. Merge into it and delete your feature branch.
  2. You may also choose to merge your feature branch into another project’s feature branch, and then close yours.
  3. If you would like to take only the changes that you've done and merge them into another branch, without including the changes of your base branch, then you can use git rebase. It can be a complex operation and works best on relatively small changesets.


Experimental work

A common situation is that you have two separate feature branches and you would like to try out how both of them behave together. Simply create a third, short-lived branch based on the one feature branch and with the second one merged into it. If in the process of testing the combination of both branches you discover that additional changes are needed, then you can commit them first into your experimental branch. Afterwards use git-cherry-pick to pick them into one of the two originating branches and delete your experimental branch again.