Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does git push origin always merges to master branch?

Tags:

git

terminal

So Initially when I clone the repo it has two branches

*master
*develop

Then on my local machine I create a new branch from develop

git checkout develop
git checkout -b feature/new-feature

I am done with all the commit on my local machine and I want to it to merge with develop branch on github again.

git push origin feature/new-feature

Does this gonna create a pull request to merge into develop branch or master branch?

like image 520
Aditya Verma Avatar asked Oct 16 '25 11:10

Aditya Verma


2 Answers

It won't create a Pull Request automatically.

It just pushes the branch to the remote.

If you want to have a pull request, you will have to create it yourself, except if you have a scriot that does it for you.

You can decide what target branch to use when creating the pull request.

Note that pull requests are a feature of some git servers (like GitHub) and not (directly) a feature of git.

Pushing the new branch will create that (exact same) branch on the server. If you want to merge it in an existing branch, you can do this either local(git merge command) or by creating a new pull request if the server supports it.

like image 159
dan1st Avatar answered Oct 18 '25 06:10

dan1st


git push origin feature/new-feature will create a push to your new branch feature/new-feature. Not in master or develop branch

If you want all changes in the develop branch, you must merge from feature/new-feature branch like git merge develop.

Nice explaining -> www.freecodecamp.org

like image 39
SwissCodeMen Avatar answered Oct 18 '25 08:10

SwissCodeMen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!