70 lines
1.7 KiB
Markdown
70 lines
1.7 KiB
Markdown
---
|
|
sidebar_position: 2
|
|
title: "Development & Rebasing"
|
|
---
|
|
|
|
# Development & Rebasing
|
|
|
|
---
|
|
|
|
## Step 5 — Work on the Task
|
|
|
|
- Implement the changes required by the task on your feature branch.
|
|
- Commit your work as you go with clear, descriptive commit messages:
|
|
|
|
```bash
|
|
git add .
|
|
git commit -m "#<task_number> - Short description of what was done"
|
|
```
|
|
|
|
For example:
|
|
|
|
```bash
|
|
git commit -m "#42 - Add stock export to Excel functionality"
|
|
```
|
|
|
|
> You may have as many commits as needed on your feature branch.
|
|
|
|
## Step 6 — Update `dev` Again Before Rebasing
|
|
|
|
Before rebasing, fetch the latest changes from remote so your rebase is based on the most current state of `dev`:
|
|
|
|
```bash
|
|
git checkout dev
|
|
git pull
|
|
```
|
|
|
|
> This step is important. If another developer pushed to `dev` while you were working, you need those changes before you rebase, otherwise you may introduce conflicts or overwrite work.
|
|
|
|
## Step 7 — Switch Back to Your Feature Branch
|
|
|
|
```bash
|
|
git checkout feature/<task_number>
|
|
```
|
|
|
|
## Step 8 — Rebase the Feature Branch onto `dev`
|
|
|
|
```bash
|
|
git rebase dev
|
|
```
|
|
|
|
This replays your commits on top of the latest `dev`, as if you had started your work from the current state of the branch. The result is a clean, linear history with no unnecessary merge commits from intermediate states.
|
|
|
|
> If conflicts arise during the rebase:
|
|
> 1. Git will pause and show which files have conflicts.
|
|
> 2. Open the conflicting files, resolve the conflicts manually.
|
|
> 3. Stage the resolved files:
|
|
> ```bash
|
|
> git add <file>
|
|
> ```
|
|
> 4. Continue the rebase:
|
|
> ```bash
|
|
> git rebase --continue
|
|
> ```
|
|
> 5. Repeat until the rebase completes.
|
|
>
|
|
> If you need to abort and start over:
|
|
> ```bash
|
|
> git rebase --abort
|
|
> ```
|