- Create a New Branch:
- Create a new branch from the default branch (main):
git checkout main
git pull origin main
git checkout -b feat/your-feature-name
- Replace
your-feature-name
with a descriptive name for your new feature.
Alternatively, for fixing an issue:
git checkout main
git pull origin main
git checkout -b fix/your-issue-name
- Replace
your-issue-name
with a descriptive name for your issue.
- Branch Naming Conventions:
- Ensure that branch names do not contain any capital letters.
- For adding a new feature, the branch name should start with
feat/
followed by the feature name. - For fixing an issue, the branch name should start with
fix/
followed by the issue name.
- Work on the Feature or Fix:
- Implement your feature or fix in the newly created branch.
- Make sure to commit your changes regularly.
- Pull Latest Changes:
- Before creating a new branch or raising a pull request (PR), pull the latest changes from the remote repository:
git checkout main
git pull origin main
- Create a Pull Request:
- Once your feature or fix is ready, push the branch to the remote repository:
git push origin feat/your-feature-name
or
git push origin fix/your-issue-name
- Create a pull request on the GitHub repository. Ensure that the pull request is targeting the main branch.
- Pull Request Review:
- The main branch is protected, so all changes must go through a pull request.
- A reviewer will be assigned to review and approve the pull request.
- Make any necessary changes based on the reviewer's feedback.
- Merge to Main:
- Once the pull request is approved, it can be merged into the main branch.
- Repeat as Needed:
- Repeat the process for adding new features or fixing issues by creating new branches and pull requests.
- Follow these steps consistently to maintain a clean and organized version history.
- Regularly pull the latest changes from the remote main branch to avoid conflicts.
- Adhere to branch naming conventions for clarity and consistency in the version history.