Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 1.27 KB

merge-branches.md

File metadata and controls

43 lines (29 loc) · 1.27 KB

💭 Merging x branch to y branch

git merge combines changes from two branches. Its primamry purpose is to integrate changes made in one branch (source branch) into another (target branch) and share those changes with other developers.

The master or main branch in Git is a repository's default and primary branch. It usually represents the latest stable version of the project's code.

  1. Switch to master branch

    dev@dev:~/your-project$ git switch master

    ℹ️ NOTE

    Ensure you are on the branch you want to merge into.

  2. Merge the y branch into master branch

    This will merge the [branch-name] to the current branch.

    dev@dev:~/your-project$ git merge [branch-name]

    ℹ️ NOTE

    Remember to replace [branch-name] with your branch name (e.g. develop).

    Example: git merge develop

  3. Push the local changes to the remote repository

    dev@dev:~/your-project$ git push -u origin master

📋 Related Articles