## Git Workflow
The Git workflow typically involves the following steps:
1. **Create a branch:** In your repository, you create a branch off the main branch. This is often referred to as a "feature branch" or a "topic branch." You can name this branch anything, but it's best to give it a name that represents the feature you're working on.
- Command: git branch branch-name
2. **Switch to your branch:** Navigate to the new branch you just created.
- Command: git checkout branch-name
3. **Make changes:** Work on your project files and make the necessary changes.
4. **Stage changes:** When you're happy with your changes, you need to stage them. This means that you prepare them for a commit.
- Command: git add file-name (To stage a specific file)
- Command: git add . (To stage all modified files)
- **Commit changes:** After staging your changes, you can then commit them. A commit is like a snapshot of your work at a particular point in time.
- Command: git commit -m "commit message"
5. **Push changes:** Once your commit is ready, you can push your branch to the remote repository.
- Command: git push origin branch-name
6. **Create a Pull Request (PR):** You then create a Pull Request on the platform you're using (like GitHub). This is a way of saying, "I want to merge my changes into the main branch." It gives others on the project a chance to review your changes before they are merged.
7. **Review code:** Code reviews are a quality assurance activity in which one or several people check a program mainly by viewing and reading parts of its source code, with the intent to find and fix mistakes overlooked in the initial development phase. If there are any changes required, they would be done in the branch and the commits are added to the pull request.
8. **Merge Pull Request:** After the review, if everything looks good, the pull request is merged into the main branch.
9. **Pull latest changes from main branch:** Once the pull request is merged, make sure you pull the latest changes from the main branch to your local repository to stay up to date.
- Command: git checkout main (switch to main branch)
- Command: git pull origin main (pull latest changes from main branch)
Remember, all of these steps are iterative and they keep happening as you add more features or make changes to your application.
[[Write Good Commit Messages]]