Repository navigation
Understanding Git Branches and PRs: Why do we create a new branch, and what happens upon merging? #125972
|
I have a fundamental doubt:
|
Replies: 2 comments
|
Why Avoid Committing Directly to Main What Happens After the PR Merges |
Why not commit directly to main?It keeps the main app safe: Main is like the final, working product. Working on a separate branch lets you test new ideas without breaking the app for users or teammates. What happens after a Pull Request (PR) is merged?Your changes (commits): Your work gets copied over and combined into the main branch so everyone can see and use your new feature.
|
Why not commit directly to main?
It keeps the main app safe: Main is like the final, working product. Working on a separate branch lets you test new ideas without breaking the app for users or teammates.
It allows for code reviews: Creating a separate branch lets you open a Pull Request (PR) so teammates can check your code for bugs or errors before it gets added to the main project.
It makes teamwork easier: Multiple developers can work on different features at the same time on their own branches without accidentally deleting or overwriting each other's work.
What happens after a Pull Request (PR) is merged?
Your changes (commits): Your work gets copied over and combined into the main br…