2.8 KiB
2.8 KiB
trigger
| trigger |
|---|
| always_on |
Git Feature Branch Workflow
This project strictly follows the Git Feature Branch Workflow (as defined by Atlassian).
The core idea is that all feature development should take place in a dedicated branch instead of the main branch.
1. Development Workflow
- Never Commit to Main: Direct commits to
mainare strictly prohibited.mainmust always be stable and deployable. - Branch Creation: Create a descriptive branch from the latest
mainstate (e.g.,feature/animated-menu-itemsorissue-#1061):git checkout main && git pull origin main && git checkout -b feature/your-feature-name - Atomic Commits: Make small, logical, and self-contained commits to your feature branch.
- Push & Pull Request: Push the feature branch to the remote repository and open a Pull Request (PR) against
main. PRs act as a forum for discussing the feature and performing code reviews before it is merged.- GitHub Actions Rule: When setting up automated workflows (like Gemini AI PR review), always pin actions to a specific version tag (e.g.,
@v1.0.4) instead of@latestto prevent breaking changes. Ensure secrets are passed safely via repository secrets (env:), never hardcoded.
- GitHub Actions Rule: When setting up automated workflows (like Gemini AI PR review), always pin actions to a specific version tag (e.g.,
- Merge & Close: Once approved, the feature branch is merged into
mainand then deleted. (You can use theclose_featureskill for this).
2. Merge Conflict Policy
When multiple features are developed simultaneously, main might advance before your PR is merged, causing a merge conflict. The author of the pending PR is solely responsible for resolving conflicts.
Resolution Procedure:
Never force-push blindly or overwrite other developers' work without understanding it. Follow these exact steps to resolve a conflict:
- Update Local Main: Fetch the latest changes from the remote
mainbranch.git checkout main git pull origin main - Merge Main into Feature Branch: Switch back to your feature branch and merge
maininto it.git checkout feature/your-feature-name git merge main - Resolve Conflicts: Git will pause the merge and mark the conflicted files. Open these files in your editor, look for the conflict markers (
<<<<<<<,=======,>>>>>>>), and manually choose the correct code. Remove the markers once done. - Stage and Commit: After resolving all conflicts, stage the files and finish the merge commit.
git add . git commit -m "Merge main into feature and resolve conflicts" - Push Updates: Push the resolved feature branch back to the remote repository to update the Pull Request.
git push origin feature/your-feature-name