How do i sync up merge two local git branches?
-
Man page for git checkout: https://git-scm.com/docs/git-checkout
Man page for git merge: https://git-scm.com/docs/git-mergeLet's say you are working from a master repository and want to create a new feature or update some code.
If working with github, you normally clone your github repository to your local workstation. To make changes which are reviewed via pull requests it's best to create new branches to keep new features or changes separate from your local master branch. If you want to merge two local git branches, let's say for example you have branches called branchA and a branchB, you have made many changes in branchB which branchA does not have have, but decide you want submit a pull request from branchA, in short you want to merge all the changes in branchB into branchA
Check location, which branch are you on?
$ git status On branch branchB nothing to commit, working tree clean
Switch to the branch you want to merge into.
$ git checkout branchA Switched to branch 'branchA'
Merge from branchB into branchA
$ git merge branchB Updating 982a17e..2ec1baf Fast-forward dbservers.yml | 2 ++ 1 file changed, 2 insertions(+)
© Lightnetics 2024