debian-mirror-gitlab/doc/gitlab-basics/feature_branch_workflow.md

40 lines
1.1 KiB
Markdown
Raw Normal View History

2019-12-26 22:10:19 +05:30
---
2020-10-24 23:57:45 +05:30
stage: Create
group: Source Code
2022-11-25 23:54:43 +05:30
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
2019-12-26 22:10:19 +05:30
---
2021-03-11 19:13:27 +05:30
# Feature branch workflow **(FREE)**
2019-12-26 22:10:19 +05:30
2023-04-23 21:23:45 +05:30
To merge changes from a local branch to a feature branch, follow this workflow.
1. Clone the project if you haven't already:
2019-12-26 22:10:19 +05:30
2020-03-13 15:44:24 +05:30
```shell
2019-12-26 22:10:19 +05:30
git clone git@example.com:project-name.git
```
2023-04-23 21:23:45 +05:30
1. Change directories so you are in the project directory.
1. Create a branch for your feature:
2019-12-26 22:10:19 +05:30
2020-03-13 15:44:24 +05:30
```shell
2021-12-11 22:18:48 +05:30
git checkout -b feature_name
2019-12-26 22:10:19 +05:30
```
2023-04-23 21:23:45 +05:30
1. Write code for the feature.
1. Add the code to the staging area and add a commit message for your changes:
2019-12-26 22:10:19 +05:30
2020-03-13 15:44:24 +05:30
```shell
2019-12-26 22:10:19 +05:30
git commit -am "My feature is ready"
```
1. Push your branch to GitLab:
2020-03-13 15:44:24 +05:30
```shell
2021-12-11 22:18:48 +05:30
git push origin feature_name
2019-12-26 22:10:19 +05:30
```
2023-04-23 21:23:45 +05:30
1. Review your code: On the left sidebar, go to **Repository > Commits**.
1. [Create a merge request](../user/project/merge_requests/creating_merge_requests.md).
2021-04-17 20:07:23 +05:30
1. Your team lead reviews the code and merges it to the main branch.