rajsh_956
rajsh_956

Reputation: 115

Why do we need to create a branch in our forked repository to push our changes and then create a pull request to the upstream repository?

I was following this tutorial to create a pull request. In step 3 they mention that it is a good practice to create a branch while working with repositories. But I feel that if I push changes to my forked repository's main branch, it wouldn't make a difference while making a pull request.

Upvotes: 5

Views: 1154

Answers (1)

Mureinik
Mureinik

Reputation: 311508

Technically speaking, it won't make a difference. It's considered a best practice to keep your main (or master) branch as a "clean" snapshot of the repo you forked from, so you can always build it and see how the "original" repo would behave before your changes. Keeping the main/master branch clean of local changes also means you'll always be able to trivially rebase it from the upstream with no fear of conflicts.

Upvotes: 11

Related Questions