How to merge branch of forked repo into master branch of original repo?

When using GitHub, you could do this using a Pull Request. Simply push your development branch to the forked remote repository and create the pull request as described in the linked article. The owner of the original repository can then add your repository as a new remote repository, fetch your changes and merge your development branch back into the master branch.

It is usually not necessary for your master branch to be fully up-to-date — although it is extremly helpful, especially when merging the development branch.

First, you should bring the master branch in the forked repository up-to-date:

$ git remote add upstream ssh://path/to/original/repo
$ git checkout master
$ git fetch upstream # Instead of "fetch" & "merge", "pull" would also work
$ git merge upstream/master 

Then either rebase or merge your development branch into the master branch:

$ git checkout development
$ git rebase master # OR "git merge master"

Resolve any conflicts, if necessary. When merging, use git commit to finish the merge, when rebasing use git commit && git rebase --continue.

You should now be able to git push to the origin of the forked repository, and create a pull request. Alternatively, if you’re authorized to do so, you can also push directly to the original repository from your fork.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)