Merge two remote branches in a Git repository Merge two remote branches in a Git repository git git

Merge two remote branches in a Git repository


If you have remote-tracking branches set up locally, it's as simple as:

git checkout productiongit merge developmentgit push origin production

If you have not yet set up remote-tracking branches, you could do something like:

git fetch origingit checkout production     # or `git checkout -b production origin/production` if you haven't set up production branch locallygit merge origin/developmentgit push origin production


you can do this like:

git pull origin development:tempgit push origin temp:production

Why a temp branch is need and you should not to use the local development?Because your local development may not be the same as the remote one.