Search code examples
githubversion-controlpull-requestgit-pull

Github - How to merge to remote feature branch


My team mate created a feature branch from our master branch. I created my own feature branch based off of team mate's feature branch. i.e.

Team mate:

git checkout master
git checkout -b teammateA-feature-branch

What I did:

git checkout teammateA-feature-branch
git pull
git checkout -b teammateB-feature-branch 

I made my changes into teammateB-feature-branch and committed them. Now, how would I create a PR such that my committed changes gets merged to team mate's remote branch i.e. teammateB-feature-branch merging into teammateA-feature-branch?? Any thoughts??


Solution

  • You can do this locally using Git bash:

    git checkout teammateA-feature-branch
    git merge teammateB-feature-branch
    

    Then, push changes to teammateA-feature-branch:

    git push origin teammateA-feature-branch:teammateA-feature-branch
    

    OR


    If these branches are available remotely (and locally), you can do the following:

    1. Go to the pull requests tab in your repository.
    2. Click on the Compare button.
    3. Compare teammateA-feature-branch with teammateB-feature-branch.
    4. Create your pull request.
    5. Merge your changes.