git draft что такое
Draft merge requests
If a merge request isn’t ready to merge, potentially because of continued development or open threads, you can prevent it from being accepted before you mark it as ready. Flag it as a draft to disable the Merge button until you remove the Draft flag:
Mark merge requests as drafts
Mark merge requests as ready
When a merge request is ready to be merged, you can remove the Draft flag in several ways:
Viewing a merge request: In the top right corner of the merge request, click Mark as ready. Users with Developer or greater permissions can also scroll to the bottom of the merge request description and click Mark as ready:
In GitLab 13.10 and later, when you mark a merge request as ready, notifications are triggered to merge request participants and watchers.
Include or exclude drafts when searching
Select Yes to include drafts, or No to exclude, and press Return to update the list of merge requests:
Pipelines for drafts
When the pipelines for merged results feature is enabled, draft merge requests run merge request pipelines only.
To run pipelines for merged results, you must mark the merge request as ready.
Changing the stage of a pull request
In this article
You can mark a draft pull request as ready for review or convert a pull request to a draft.
People with write permissions to a repository and pull request authors can change the stage of a pull request.
Draft pull requests are available in public repositories with GitHub Free for organizations and legacy per-repository billing plans, and in public and private repositories with GitHub Team, GitHub Enterprise Server 2.17+, and GitHub Enterprise Cloud. For more information, see «GitHub’s products.»
Marking a pull request as ready for review
When you’re ready to get feedback on your pull request, you can mark your draft pull request as ready for review. Marking a pull request as ready for review will request reviews from any code owners.
Tip: You can also mark a pull request as ready for review using the GitHub CLI. For more information, see » gh pr ready » in the GitHub CLI documentation.
Under your repository name, click
Pull requests.
In the «Pull requests» list, click the pull request you’d like to mark as ready for review.
Converting a pull request to a draft
You can convert a pull request to a draft at any time. For example, if you accidentally opened a pull request instead of a draft, or if you’ve received feedback on your pull request that needs to be addressed, you can convert the pull request to a draft to indicate further changes are needed. No one can merge the pull request until you mark the pull request as ready for review again. People who are already subscribed to notifications for the pull request will not be unsubscribed when you convert the pull request to a draft.
Under your repository name, click
Pull requests.
In the «Pull requests» list, click the pull request you’d like to convert to a draft.
In the right sidebar, under «Reviewers,» click Convert to draft.
Click Convert to draft.
The GitHub Blog
Introducing draft pull requests
At GitHub, we’ve always felt that you should be able to open a pull request to start a conversation with your collaborators as soon as your brilliant idea or code is ready to take shape. Even if you end up closing the pull request for something else, or refactoring the code entirely, a good pull request is as much about collaboration as it is about code.
But what if you want to signal that a pull request is just the start of the conversation and your code isn’t in any state to be judged? Perhaps the code is for a hackathon project. You have no intention of ever merging it, but you’d still like people to check it out locally and give you feedback. Or perhaps you’ve opened a pull request without any code at all in order to get the discussion started.
Tag your work in progress
With draft pull requests, you can clearly tag when you’re coding a work in progress. Now when you open a pull request, a dropdown arrow appears next to the “Create pull request” button. Toggle the dropdown arrow whenever you want to create a draft instead.
A draft pull request is styled differently to clearly indicate that it’s in a draft state. Merging is blocked in draft pull requests. Change the status to “Ready for review” near the bottom of your pull request to remove the draft state and allow merging according to your project’s settings. Also, if you have a CODEOWNERS file in your repository, a draft pull request will suppress notifications to those reviewers until it is marked as ready for review.
Get started
Draft pull requests are ready for your code in public and open source repositories, as well as in private repositories for groups using GitHub Team and Enterprise Cloud.
Pull request’ы на GitHub или Как мне внести изменения в чужой проект
По просьбе tulskiy делаю вольный перевод частей официальной документации GitHub’а Fork A Repo и Send pull requests.
Итак, что же такое «запрос на включение (сделанных вами изменений)» (именно так я перевёл pull request)? В официальной документации гитхаба говорится следующее:
Pull request’ы позволяют вам рассказать другим о тех изменениях, которые вы разместили в своём GitHub-репозитории. Как только pull request отправлен, заинтересованные стороны рассматривают ваши изменения, обсуждают возможные правки или даже добавляют дополняющие коммиты, если нужно.
Немного о моделях совместной разработки
Делаем копию репозитория
Рассматривая первую модель разработки, необходимо иметь свою копию изначального репозитория, в которой и будет вестись работа, и изменения из которой и будут предлагаться затем автору изначального репозитория.
В рамках руководства, будем считать, что мы работаем над репозиторием Spoon-Knife пользователя octocat, а ваше имя пользователя — username.
Сделать это очень просто: на странице репозитория имеется кнопочка «Fork», которую и следует нажать.
После чего, эту свою копию уже можно «стянуть» на свой компьютер:
Склонированный репозиторий имеет одну привязку к удалённому репозиторию, названную origin, которая указывает на вашу копию на GitHub, а не на оригинальный репозиторий, чтобы отслеживать изменения и в нём, вам нужно будет добавить другую привязку, названную, например, upstream.
Делаем работу
Итак, в этой точке мы уже можем править код и делать коммиты. Если вы сделали все предыдущие шаги, чтобы потом вернуть ваши изменения в оригинальный репозиторий, то я настоятельно советую делать всю работу в отдельной тематической ветви разработки. Полезность этого станет ясна на этапе посылки pull request’а. Пускай она будет называться feature.
Вот, теперь творите добро (и пусть оно будет выражаться в коммитах).
Как только вы сделали работу (или её часть), отправьте её в свою копию репозитория на GitHub:
Возвращаем изменения: Pull request
Итак, всё сделано. Вы написали код, он у вас в ветви feature как у вас на компьютере, так и на GitHub’е. Осталось только «заслать» его в оригинальный репозиторий.
Идите на страницу вашей копии репозитория на GitHub, выбирайте ветвь feature и жмите кнопку Pull Request.
Далее вы попадёте на предпросмотровую страницу, на которой сможете ввести название и описание ваших изменений (название потом попадёт в описание мёрдж-коммита и станет достоянием общественности, учтите это).
Там же вы можете посмотреть, какие коммиты попали в пулл реквест:
А так же общий diff всех изменений в пулл реквесте:
По умолчанию, пулл реквесты считаются основанными на самой часто интегрируемой ветви родительского репозитория. В этом случае username/Spoon-Knife был скопирован с octocat/Spoon-Knife, так что pull request считается основанным на ветке master репозитория octocat/Spoon-Knife. В большинстве случаев, это будет корректно, но если не так, то вы можете нажать на кнопку «Change Commits»
Вы попадёте в форму выбора базовой и исходной ветвей:
Слева выбираете в какую ветку будут вливаться изменения в родительском репозитории, справа — какие изменения будут браться с вашего репозитория. По примеру: справа octocat/Spoon-Knife/master, слева username/Spoon-Knife/feature. Здесь вы можете указывать не только ветки, но так же теги и id отдельных коммитов в соответствующем репозитории.
ВАЖНО: Договоритесь с владельцем «родительского» репозитория, в какую ветку будете вливать изменения (он может написать это в README)
Изменение базового репозитория меняет и список людей, кто получит уведомление о пулл реквесте. Каждый, кто имеет право «на запись» в базовый репозиторий, получит письмо и увидит уведомление на главной GitHub’а, в следующий раз, как на него зайдёт.
Как только список коммитов вас удовлетворит, нажмите кнопку Update Commit Range.
Когда вы ввели название и описание и перепроверили список коммитов и изменения в файлы, попавшие в пулл реквест, нажмите кнопку Send pull request. Пулл реквест будет создан незамедлительно.
Что дальше?
Следите за вашим пулл-реквестом. Что прокомментируют люди, что скажет мэйнтэйнер, примет или нет ваш пулл реквест.
Когда ваш pull request примут, не забудьте слить изменения в свой репозиторий (или удалить его, если больше не нужен):
Так же можно удалить ветку, в которой велась разработка:
Что следует делать, если работа заняла большое время и оригинальный репозиторий успел уйти вперёд?
Можно просто влить изменения из оригинального репозитория к себе:
Однако хозяину оригинального репозитория или, может быть, даже вам, не понравится наличие мёрж-коммитов и коммитов из master’а в списке коммитов на пулл. В таком случае вам стоит воспользоваться git rebase.
Прочитать про то, как работает rebase можно в официальном руководстве. Там имеются и очень понятные иллюстрации. Так же есть статья в помощи GitHub.
ВНИМАНИЕ: Пожалуйста, учтите, что git rebase меняет id коммитов! Поэтому, все действия с этой командой стоит выполнять только на локальном репозитории, до того, как эти коммиты станут общедоступны, т.е. до того, как вы их push’нули на гитхаб.
Если вы хозяин: Как принять pull request
Если пулл реквест удовлетворяет всем условиям, то кто-либо с правом «на запись» (т.е. может сделать push) в целевой репозиторий, должен принять pull request одним из многих методов. Ниже описаны три наиболее популярных метода:
Auto Merge (автослияние)
Во многих случаях можно попросить github автоматически принять пулл реквест, используя большую зелёную кнопку Merge Pull Request, которая сама вольёт изменения, создаст мёрж-коммит и закроет пулл реквест.
Подробнее можно почитать в этом хабратопике: Кнопка слияния на GitHub.
Fetch and Merge (скачать и слить)
Основной метод вливания изменений. Он требует добавления remote, ведущего к репозиторию человека, отправившего pull request, скачивания изменений с этого репозитория, объединения нужной ветви, исправления конфликтов и выгрузки обновлённой ветви обратно в исходный репозиторий:
Patch and Apply (пропатчить и принять)
Предыдущий метод работает хорошо, когда вы работаете в команде или постоянно принимаете изменения от одной и той же группы людей. Другой метод немного быстрее в единичных случаях при использовании git-am.
Закрытие пулл реквеста
Запросы на пулл автоматически закрываются, когда запрошенные коммиты вливаются в репозиторий назначения. При этом генерируется событие, информирующее всех участников разработки, что пулл реквест был принят и влит в основную ветвь.
Так же возможно вручную закрыть пулл реквест в случае, если он был отклонён. Иногда это необходимо в случаях, когда изменения были приняты с помощью git-cherry-pick или другого механизма, который не позволяет обнаружить факт слияния (merge).
Release Drafter
v5.15.0 Latest version
Release Drafter
Drafts your next release notes as pull requests are merged into master
Installation
Drafts your next release notes as pull requests are merged into master. Built with Probot.
If you’re unable to use GitHub Actions, you can use the Release Drafter GitHub App. Please refer to the Release Drafter GitHub App documentation for more information.
As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you’re ready:
The following is a more complicated configuration, which categorises the changes into headings, and automatically suggests the next version number:
You can use any of the following variables in your template :
Variable | Description |
---|---|
$CHANGES | The markdown list of pull requests that have been merged. |
$CONTRIBUTORS | A comma separated list of contributors to this release (pull request authors, commit authors, and commit committers). |
$PREVIOUS_TAG | The previous releases’s tag. |
Category Template Variables
You can use any of the following variables in category-template :
Next Version Variables
Version Template Variables
Variable | Description |
---|---|
$PATCH | The patch version number. |
$MINOR | The minor version number. |
$MAJOR | The major version number. |
$COMPLETE | The complete version string (including any prerelease info). |
Change Template Variables
You can use any of the following variables in change-template :
Note: This is only revelant for GitHub app users as references is ignored when running as GitHub action due to GitHub workflows more powerful on conditions
References takes an list and accepts strings and regex. If none are specified, we default to the repository’s default branch usually master.
Currently matching against any ref/heads/ and ref/tags/ references behind the scene
Categorize Pull Requests
Pull requests with the label «feature» or «fix» will now be grouped together:
Adding such labels to your PRs can be automated by using the embedded Autolabeler functionality (see below), PR Labeler or Probot Auto Labeler.
Exclude Pull Requests
Pull requests with the label «skip-changelog» will now be excluded from the release draft.
Include Pull Requests
Pull requests with the label «app-foo» will be the only pull requests included in the release draft.
You can search and replace content in the generated changelog body, using regular expressions, with the replacers option. Each replacer is applied in order.
You can add automatically a label into a pull request, with the autolabeler option. Available matchers are files (glob), branch (regex), title (regex) and body (regex). Matchers are evaluated independently; the label will be set if at least one of the matchers meets the criteria.
Projects that don’t use Semantic Versioning
The Release Drafter GitHub Action accepts a number of optional inputs directly in your workflow configuration. These will typically override default behavior specified in your release-drafter.yml config.
The Release Drafter GitHub Action sets a couple of outputs which can be used as inputs to other Actions in the workflow (example).
If you have Node v10+ installed locally, you can run the tests, and a local app, using the following commands:
Once you’ve started the app, visit localhost:3000 and you’ll get step-by-step instructions for installing it in your GitHub account so you can start pushing commits and testing it locally.
If you don’t have Node installed, you can use Docker Compose:
Third-party contributions are welcome! 🙏🏼 See CONTRIBUTING.md for step-by-step instructions.
If you need help or have a question, let me know via a GitHub issue.
If you want to deploy your own copy of Release Drafter, follow the Probot Deployment Guide.