Skip to content

Branch Management

DupelaWebsite edited this page Sep 6, 2024 · 18 revisions

Main branch

Develop

Note

Make sure that you are always in sync with the main branch. Regularly merge changes from main into develop. This keeps develop up to date with the latest stable code and ensures that any work done in develop is built on top of the latest changes in main.

Workflow to Sync Develop with Main:

  • Ensure main is up to date: Before syncing develop with main, make sure you have the latest changes from main.
  • Merge main into develop: Once main is updated, merge it into develop to bring all new changes into the development branch.
  • Resolve conflicts: If there are conflicts during the merge, resolve them before committing.
  • Test the code: After merging, ensure everything works properly in develop before continuing development.
Sync Develop with Main Steps:
# Step 1: Switch to the 'main' branch
git checkout main

# Step 2: Pull the latest changes from the remote repository
git pull origin main

# Step 3: Switch to the 'develop' branch
git checkout develop

# Step 4: Merge 'main' into 'develop'
git merge main

# Step 5: Resolve any merge conflicts if necessary

# Step 6: Push the updated 'develop' branch to the remote repository
git push origin develop

The Develop branch is the main branch for ongoing development. Features are developed in separate branches and merged into develop after they are completed and tested.

Develop Workflow:

  1. Create a feature branch from develop: All new features should branch off from develop.
  2. Develop and test: Perform development work in the feature branch, ensuring that it is fully tested.
  3. Merge back into develop: Once the feature is complete and tested, merge it back into the develop branch.

Develop Steps

# Ensure your 'develop' branch is up to date
git checkout develop
git pull origin develop

# Create a new feature branch from 'develop'
git checkout -b feature/new-feature

# Apply your development changes, bug fixes, or new features

# Stage and commit your changes
git add .
npx git-cz  # Commitizen for standardized commit messages

# Push the feature branch to GitHub
git push origin feature/new-feature

Merging Back into Develop:

# Switch back to 'develop'
git checkout develop
git pull origin develop

# Merge your feature branch into 'develop'
git merge feature/new-feature

# Push the updated 'develop' branch to GitHub
git push origin develop

Important

Always keep develop up to date: Regularly pull the latest changes from develop to avoid conflicts. Feature branches: All new work should be done in a feature branch and merged into develop once complete. Stable codebase: Ensure all code merged into develop is stable and has been tested.

Note

Naming convention for branches should follow the format: alpha/scope-feature-name. For more details, click here.

Feature

The Feature branch workflow is used for working on individual features or tasks before merging them back into the develop branch. Each new feature or bug fix should be developed in its own feature branch, which is then merged into develop once the feature is complete and tested.

Workflow Overview:

  1. Create a new feature branch from develop: All feature development should branch off from develop.
  2. Develop and test your feature: Perform development work in the feature branch.
  3. Regularly pull updates from develop: Keep your feature branch in sync with develop to avoid conflicts.
  4. Merge the feature back into develop: After the feature is completed and tested, merge it back into develop.
  5. Clean up the feature branch: Once merged, the feature branch can be deleted.

Steps for Working with Feature Branches

Step 1: Create a New Feature Branch

Before you start developing a new feature, create a new branch from develop.

# Ensure your 'develop' branch is up to date
git checkout develop
git pull origin develop

# Create a new feature branch
git checkout -b feature/my-new-feature
Step 2: Develop and Test

Make changes to your code, implement the feature, and test it thoroughly within this branch.

# Make your changes
# Stage and commit your changes
git add .
npx git-cz  # Use Commitizen to standardize commit messages

# Push your feature branch to the remote repository
git push origin feature/my-new-feature
Step 3: Keep Your Feature Branch in Sync with Develop

While developing, regularly pull the latest changes from develop to keep your feature branch up to date and avoid conflicts later.

# Pull the latest changes from 'develop' and merge into your feature branch
git pull origin develop

# Resolve any conflicts and commit changes
git add .
npx git-cz
Step 4: Merge Feature Branch into Develop

Once the feature is fully developed and tested, it’s time to merge it back into develop.

# Switch back to the 'develop' branch
git checkout develop
git pull origin develop

# Merge your feature branch into 'develop'
git merge feature/my-new-feature

# Push the updated 'develop' branch to the remote repository
git push origin develop
Step 5: Clean Up the Feature Branch

After successfully merging the feature into develop, you can delete the feature branch locally and remotely to keep the repository clean.

# Delete the feature branch locally
git branch -d feature/my-new-feature

# Delete the feature branch from the remote repository
git push origin --delete feature/my-new-feature

Feature Testing Branch Workflow

The Feature Testing Branch is used to test a feature before merging it into develop. It is a branch created from the feature branch, allowing isolated testing without affecting the main develop branch. This helps catch bugs or issues before the feature is finalized.

Workflow Overview:

  1. Create a feature testing branch from the feature branch: This branch is created specifically for testing a new feature.
  2. Test the feature: Perform tests, fix bugs, and ensure the feature is stable.
  3. Merge back into the feature branch: Once testing is complete, merge any fixes back into the original feature branch.
  4. Continue the standard feature workflow: After testing, follow the normal process to merge the feature back into develop.

Steps for Working with Feature Testing Branches

Step 1: Create a New Feature Testing Branch

After developing a feature, create a new testing branch from your feature branch to start testing the feature.

# Ensure you're on the feature branch and it is up to date
git checkout feature/my-new-feature
git pull origin feature/my-new-feature

# Create a new feature testing branch from the feature branch
git checkout -b feature/test-my-new-feature
Step 2: Perform Testing

Run tests, identify bugs, and make necessary fixes in the feature testing branch. Once the testing is complete and any bugs have been resolved, commit and push the changes.

# Make changes or bug fixes
# Stage and commit changes
git add .
npx git-cz  # Use Commitizen for standardized commit messages

# Push the feature testing branch to the remote repository
git push origin feature/test-my-new-feature
Step 3: Merge Feature Testing Branch Back into Feature

Once the feature testing is complete and all issues have been resolved, merge the feature testing branch back into the original feature branch.

# Switch back to the feature branch
git checkout feature/my-new-feature
git pull origin feature/my-new-feature

# Merge the testing branch into the feature branch
git merge feature/test-my-new-feature

# Push the updated feature branch to the remote repository
git push origin feature/my-new-feature
Step 4: Continue the Feature Workflow

After merging the testing branch into the feature branch, continue the normal feature workflow, including merging the feature into develop after testing is complete.

# Switch to 'develop' branch
git checkout develop
git pull origin develop

# Merge the feature branch into 'develop'
git merge feature/my-new-feature

# Push the updated 'develop' branch to the remote repository
git push origin develop
Step 5: Clean Up the Feature Testing Branch

After merging the feature testing branch into the feature branch, delete the feature testing branch to keep the repository clean.

# Delete the feature testing branch locally
git branch -d feature/test-my-new-feature

# Delete the feature testing branch from the remote repository
git push origin --delete feature/test-my-new-feature

Alpha

The Alpha branch is used for testing new features after initial development in the feature branch and before final testing in the beta branch. This branch is created from develop and serves as a testing environment to identify and resolve bugs before moving forward.

Workflow Overview:

  1. Create an alpha branch from develop: After completing development in the feature branch and merging it into develop, create an alpha branch for testing.
  2. Perform alpha testing: Test and identify bugs within the alpha branch. Apply fixes and improvements.
  3. Merge back into develop: After successful alpha testing, merge the alpha branch back into develop or proceed to beta for final testing.
  4. Prepare for beta testing: Once alpha testing is complete and the feature is stable, create a beta branch for further testing.

Steps for Working with Alpha Branches

Step 1: Create a New Alpha Branch

After merging the feature into develop, create a new alpha branch to begin testing.

# Ensure your 'develop' branch is up to date
git checkout develop
git pull origin develop

# Create a new alpha branch from 'develop'
git checkout -b alpha/new-feature

Step 2: Perform Alpha Testing

Test the feature in the alpha branch and apply bug fixes or improvements as needed. Commit and push the changes after testing.

# Make changes or bug fixes
# Stage and commit changes
git add .
npx git-cz  # Use Commitizen for standardized commit messages

# Push the alpha branch to the remote repository
git push origin alpha/new-feature

Step 3: Merge Alpha Branch Back into Develop

Once testing is complete and the feature is stable, merge the alpha branch back into develop or move forward to the beta branch.

# Switch to the 'develop' branch
git checkout develop
git pull origin develop

# Merge the alpha branch into 'develop'
git merge alpha/new-feature

# Push the updated 'develop' branch to the remote repository
git push origin develop

Step 4: Prepare for Beta Testing

After merging the changes back into develop, create a beta branch from develop for final testing.

# Switch to 'develop' and create a new beta branch
git checkout develop
git pull origin develop
git checkout -b beta/new-feature

# Push the beta branch to the remote repository
git push origin beta/new-feature

Step 5: Clean Up the Alpha Branch

Once the alpha branch has been merged into develop or moved to beta, you can delete the alpha branch to maintain a clean repository.

# Delete the alpha branch locally
git branch -d alpha/new-feature

# Delete the alpha branch from the remote repository
git push origin --delete alpha/new-feature

Note

If you discover bugs during the alpha or beta testing phases, create a specific bug-fixing branch from the respective branch. This ensures that all bug fixes are managed in an isolated environment without affecting the main feature development. Once the bug is fixed, merge the bug-fixing branch back into the original alpha or beta branch.

Example:

For Alpha:
# Create a bug-fixing branch from alpha
git checkout alpha/new-feature
git pull origin alpha/new-feature
git checkout -b alpha/bug-feature-new

# Apply bug fixes, then stage, commit, and push changes
git add .
npx git-cz
git push origin alpha/bug-feature-new

# Merge the bug-fixing branch back into alpha after fixes
git checkout alpha/new-feature
git merge alpha/bug-feature-new
git push origin alpha/new-feature

# Clean up the bug-fixing branch
git branch -d alpha/bug-feature-new
git push origin --delete alpha/bug-feature-new

Beta

The Beta branch is used for final testing before a feature or release is merged into the main branch. This branch is created from alpha and serves as the final checkpoint for quality assurance and pre-release testing. Once everything is verified, the beta branch is merged into main, and the release can be made public.

Workflow Overview:

  1. Create a beta branch from alpha: Once alpha testing is complete, create a beta branch for final testing.
  2. Perform beta testing: Conduct thorough testing and final bug fixes in the beta branch.
  3. Merge beta into main: After successful testing, merge the beta branch into main for release.
  4. Update develop: After releasing to main, ensure develop is updated with any changes from beta.

Steps for Working with Beta Branches

Step 1: Create a New Beta Branch

After testing and fixing issues in the alpha branch, create a beta branch for final testing.

# Ensure you're on the alpha branch and it is up to date
git checkout alpha/new-feature
git pull origin alpha/new-feature

# Create a new beta branch from the alpha branch
git checkout -b beta/new-feature

Step 2: Perform Beta Testing

Test the feature in the beta branch, applying any final bug fixes or adjustments as needed. Once the feature is stable and fully tested, commit your changes.

# Make final adjustments or bug fixes
# Stage and commit changes
git add .
npx git-cz  # Use Commitizen for standardized commit messages

# Push the beta branch to the remote repository
git push origin beta/new-feature

Step 3: Merge Beta Branch into Main

Once beta testing is complete and the feature is ready for release, merge the beta branch into main for production deployment.

# Switch to the 'main' branch
git checkout main
git pull origin main

# Merge the beta branch into 'main'
git merge beta/new-feature

# Push the updated 'main' branch to the remote repository
git push origin main

Step 4: Update Develop with Beta Changes

After the beta branch has been merged into main, it's important to update the develop branch with any changes made during beta testing.

# Switch to the 'develop' branch
git checkout develop
git pull origin develop

# Merge the beta branch into 'develop' to ensure it's up to date
git merge beta/new-feature

# Push the updated 'develop' branch to the remote repository
git push origin develop

Step 5: Clean Up the Beta Branch

Once the beta branch has been merged into both main and develop, you can delete the beta branch to keep the repository clean.

# Delete the beta branch locally
git branch -d beta/new-feature

# Delete the beta branch from the remote repository
git push origin --delete beta/new-feature

Note

If you discover bugs during the alpha or beta testing phases, create a specific bug-fixing branch from the respective branch. This ensures that all bug fixes are managed in an isolated environment without affecting the main feature development. Once the bug is fixed, merge the bug-fixing branch back into the original alpha or beta branch.

Example:

For Beta:
# Create a bug-fixing branch from beta
git checkout beta/new-feature
git pull origin beta/new-feature
git checkout -b beta/bug-feature-new

# Apply bug fixes, then stage, commit, and push changes
git add .
npx git-cz
git push origin beta/bug-feature-new

# Merge the bug-fixing branch back into beta after fixes
git checkout beta/new-feature
git merge beta/bug-feature-new
git push origin beta/new-feature

# Clean up the bug-fixing branch
git branch -d beta/bug-feature-new
git push origin --delete beta/bug-feature-new

Note

Naming convention for branches should follow the format: alpha/scope-feature-name. For more details, click here.

Clone this wiki locally