Github: Working with branches

Full Stack Developer | HTML,CSS, Javascript, WordPress | @sinapradip
To collaborate effectively with your frontend developer using Git and GitHub, you can follow these steps:
1. Create a New Branch for Your Work
Each developer should work on their own branch to avoid conflicts and keep the main branch stable.
Create a new branch:
git checkout -b backend-featureReplace
backend-featurewith a meaningful branch name (e.g.,backend-auth,backend-api).Push the branch to GitHub:
git push -u origin backend-feature
2. Commit and Push Your Changes
Stage your changes:
git add .Commit your changes:
git commit -m "Implemented backend authentication"Push your changes to the branch:
git push
3. Notify the Collaborator
Once your changes are pushed, notify the frontend developer (Nirajan Malla) to review your branch.
4. Create a Pull Request (PR)
Go to your GitHub repository.
Switch to the branch you just pushed (e.g.,
backend-feature).Click on "Compare & pull request".
Add a title and description for the PR.
Assign the PR to Nirajan Malla for review.
Click "Create pull request".
5. Review and Merge
Nirajan can review your PR and suggest changes if needed.
Once approved, you or Nirajan can merge the PR into the
mainbranch.
6. Pull Changes from main
After merging, make sure to pull the latest changes from the main branch to keep your local repository up-to-date:
git checkout main
git pull origin main
7. Repeat for Frontend Developer
Nirajan can follow the same process:
Create a new branch (e.g.,
frontend-feature).Push changes to the branch.
Create a PR for you to review and merge.
Best Practices
Branch Naming Convention:
- Use descriptive branch names like
backend-auth,frontend-ui, etc.
- Use descriptive branch names like
Commit Messages:
- Write clear and concise commit messages (e.g.,
Added JWT authentication).
- Write clear and concise commit messages (e.g.,
Pull Regularly:
Regularly pull changes from the
mainbranch to avoid conflicts:git pull origin main
Code Reviews:
- Always review each other's PRs before merging.
Use GitHub Issues:
- Create GitHub issues to track tasks and assign them to the appropriate developer.
By following this workflow, you and Nirajan can collaborate efficiently while maintaining a clean and stable codebase.




