Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to merge the code from one branch to another using commands

Suresh thogari June 21, 2023

will you provide the commnads to merge from one branch to another using commands and if there is any conflicts i would like to override from source to destination branch so there should not be any manual conflict resolution should required.

please provide that is the way to achieve this.

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 23, 2023

Hi Suresh,

If you want to merge source-branch into destination-branch locally, you can do the following:

git checkout destination-branch

If you want to keep the version of the files in the source branch, in case of conflicts, you can then use:

git merge --strategy-option theirs source-branch -m "merge commit message"

If you want to keep the version of the files in the destination branch, in case of conflicts, you can use the following instead:

git merge --strategy-option ours source-branch -m "merge commit message"

You need to replace destination-branch and source-branch in the commands with the respective names of your branches, and also replace merge commit message with your own commit message for the merge commit.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events