Skip to content

Quick Branch Lookup

DupelaWebsite edited this page Sep 9, 2024 · 1 revision

To create the develop branch and publish it to GitHub, follow these steps:

# List all local branches
git branch 

# Create a new branch called 'develop'
git branch develop 

# Switch to the 'develop' branch
git checkout develop 

# Confirm you're on the 'develop' branch
git branch 

# Stage all changes for commit
git add . 

# Use Commitizen (npx git-cz) to commit with a standardized format
npx git-cz 

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

Side Information:

  • The develop branch will not be published to NPM, but it will be released under the changelog.
  • Always run git pull to get the latest version number updates before pushing changes.
  • You can move from develop to a feature branch if working on a specific feature.
  • Ensure semantic versioning increments (e.g., major, minor, patch) are followed when - updating version numbers.

Feature - Sample

  • Create a feature/* branch from develop.
  • For testing, create a feature/alpha/* branch.
  • Once testing is complete, merge into feature/*.
  • After completing feature testing, bug fixes, and refactoring, merge into develop.
# Ensure you are on the 'develop' branch and it's up to date
git checkout develop
git pull origin develop

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

# Optional: Pull any existing changes in the feature branch (if applicable)
git pull origin feature/new-feature

# Stage and commit changes using Commitizen (npx git-cz)
git add . 
npx git-cz

# Push the feature branch to GitHub
git push origin feature/new-feature
  • Merging Develop and Pushing to GitHub
# Switch back to 'develop' branch
git checkout develop

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

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

Alpha - sample

# Step 1: Pull the latest changes from the develop branch
git pull origin develop

# Step 2: Create a new alpha branch for the feature
git checkout -b alpha/new-feature

# Step 3: Bug fixes - create a separate branch for fixing bugs found in alpha
git checkout -b alpha/new-feature/bug

# Step 4: After bug fixes, switch back to the alpha feature branch
git checkout alpha/new-feature

# Step 5: Merge the bug fix branch into the alpha feature branch
git merge alpha/new-feature/bug

# Step 6: Stage changes for commit
git add .

# Step 7: Use Commitizen for a conventional commit message
npx git-cz

# Step 8: Push the updated alpha feature branch to the remote repository
git push origin alpha/new-feature

Beta - sample

# Step 1: Pull the latest changes from the alpha feature branch
git pull origin alpha/new-feature

# Step 2: Create a new beta branch for the feature
git checkout -b beta/new-feature

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

# Step 4: If bugs are found, create a separate branch for fixing bugs in the beta phase
git checkout -b beta/new-feature/bug

# Step 5: Once the bug is fixed, switch back to the beta feature branch
git checkout beta/new-feature

# Step 6: Merge the bug fix branch into the beta feature branch
git merge beta/new-feature/bug

# Step 7: Stage all changes
git add .

# Step 8: Use Commitizen for a structured commit message
npx git-cz

# Step 9: Push the updated beta feature branch to the remote repository
git push origin beta/new-feature

Main - Ready for release

# Step 1: Switch to the main branch
git checkout main

# Step 2: Merge the beta feature branch into the main branch
git merge beta/new-feature

# Step 3: If conflicts arise, resolve them manually by accepting incoming changes
git add <file-with-conflict>

# Step 4: After resolving all conflicts and accepting incoming changes
npx git-cz

# Step 5: Push the changes to the remote main branch
git push origin main

# Step 6: Optionally, delete the branch locally if it's no longer needed
git branch -d <branch-name>

# Step 7: Optionally, delete the branch from the remote repository if it's no longer needed
git push origin --delete <branch-name>

Removing Branch Note (Local and Remote)

# Remove the 'develop' branch locally
git branch -d branchName

# Force delete the 'develop' branch locally (if necessary)
git branch -D branchName

# Remove the 'develop' branch from the remote repository
git push origin --delete BranchName

Clone this wiki locally