S
S
Steve2021-03-16 18:56:30
git
Steve, 2021-03-16 18:56:30

How to merge 2 local branches?

I have masterand feature. But featurenot a merger with the master, and so far it cannot be merged remotely. Can this be done locally? Because when I push the changes from the remote branch featureto my local branch featureand work on it, then everything is fine, but as soon as I switch to a new branch, all the changes fly off.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Kuznetsov, 2021-03-18
@CenterJoin

Can this be done locally?
Of course you can! After you switch to a new branch (I understand that you mean local master), merge with the branch with the featurecommand:
git merge feature
This way you can check how your edits will work after they are accepted in an external repository (probably GitHub?). The main thing is not to try to send (git push) the master branch later. Since most likely the workflow involves working through pull requests on the server (Pull Request)
It seems that you have a mess in your head and do not understand what you are asking.

D
Developer, 2021-03-16
@samodum

Make another branch and merge there. If everything is fine, then merge with the main

V
Vitsliputsli, 2021-03-16
@Vitsliputsli

It is possible, but not necessary. When switching, commit the changes or use stash.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question