This guide outlines the collaborative workflow for contributing to this repository. Follow these steps to ensure smooth collaboration and code integration.
Follow the format:
<username>/<type>/<short-description>
Examples:
git checkout -b jakob/feat/user-auth # Feature branch
git checkout -b lena/fix/header-overflow # Bug fix branch
git checkout -b max/docs/contributing # Documentation update
Accepted Types:
feat/
: New features or functionality.fix/
: Bug fixes or patches.docs/
: Documentation changes.chore/
: Maintenance tasks (e.g., CI/CD, dependency updates).test/
: Adding or updating tests.refactor/
: Code restructuring (no new features/fixes).
<type>(<scope>): <subject>
Examples:
git commit -m "feat(auth): add OAuth2 login support"
git commit -m "fix(header): resolve mobile overflow"
git commit -m "docs(readme): update contribution guide"
Rules:
- Use the imperative mood ("add" instead of "added").
- Try to keep the subject line under 50 characters.
First, clone the repository to your local machine:
git clone https://github.com/peer-network/how_to_git.git
Always work in a dedicated branch to isolate your changes. Include your username, the type of your change and a brief description in the branch name:
git checkout -b your-username/type/short-description
Example:
git checkout -b jakob/docs/modify_readme
After making your edits, add the changes to the staging area and commit them with a descriptive message:
Edits: Please add a .txt file with some crative content to your branch when testing this workflow instead of changing the ReadMe.
git add .
git commit -m "feat(jakobs_test): add a funny file named jakob.txt to the project"
Push your branch to the remote repository:
git push origin your-username/type/short-description
- Navigate to the repository on GitHub.
- Click "Compare & pull request" for your newly pushed branch.
- Provide a clear title and detailed description explaining:
- The purpose of your changes.
- Any issues or features addressed.
- Additional context for reviewers.
- Keep PRs focused: Address one feature/bug per pull request.
- Tag relevant reviewers: Use
@mentions
to notify team members. - Respond to feedback: Discuss suggestions in the PRโs comment section.
To avoid merge conflicts and keep your work up to date with the latest changes, you should merge the development
branch into your feature branch at least once a day!.
This should be a daily routine!:
- โ First thing in the morning
- โ Last thing before creating a Pull Request
Steps to update your branch:
# Make sure you're on your feature branch
git checkout your-username/type/short-description
# Fetch the latest changes from remote
git fetch origin
# Merge development into your current branch
git merge origin/development
Resolve any conflicts that come up and test your changes to ensure everything still works correctly.
- Review Process: The lead developer or team will review your changes.
- Resolve Feedback: Update your branch if revisions are requested.
- Merge or Close: The PR will be merged into
main
!BY THE LEAD DEV! upon approval or closed if deemed unnecessary.
Yes, in most cases. Hereโs why and how:
-
Why Delete Merged Branches?
- โ Reduces clutter: Avoids an overwhelming list of inactive branches.
- โ Prevents confusion: Ensures only active/important branches remain visible.
- โ Avoids accidental reuse: Old branches might contain outdated code or conflicts.
-
Exceptions (When to Keep Branches):
- ๐ฟ Long-term branches: E.g.,
dev
,staging
, or version-specific branches likev2.0
. - ๐ ๏ธ Ongoing work: Branches tied to multi-PR features still in progress.
- ๐ท๏ธ Tagged releases: Branches associated with specific releases (e.g.,
release-1.3.0
).
- ๐ฟ Long-term branches: E.g.,
After merging, remove the branch from your machine:
git checkout main # Switch to main first
git pull # Always pull to confirm that everything is up to date (your branch is correctly merged into the main branch).
git branch -d branch_name # Delete the local branch
Remove the branch from GitHub:
git push origin --delete branch_name
- Sync Frequently: Regularly pull the latest
main
branch to avoid conflicts:git checkout main git pull origin main
- Write Clear Commit Messages: Explain the why, not just the what.
- Test Locally: Verify changes work before submitting a PR.
Happy Coding! ๐
Letโs build something amazing together. For advanced workflows, refer to GitHubโs Collaboration Guide.