Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clone GitHub Repository and Merge All Pull Requests

Tags:

git

github

Here is the repository I am looking to use - https://github.com/Sumi-Interactive/SIAlertView

What is the best way to clone this GitHub repository and merge all of the 36 open pull requests on that repository into the one I have just cloned?

like image 933
Mike Deluca Avatar asked Sep 11 '25 17:09

Mike Deluca


1 Answers

This would kind of achieve what you want. Clone the remote, configure fetching of pull requests and then merge each of the PR branches.

However, there are conflicts between the branches. They are changing the same files in different ways. So merging all of them together is not a trivial task. And thus the script fails.

#!/usr/bin/env bash

set -e

git clone https://github.com/Sumi-Interactive/SIAlertView
cd SIAlertView

git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"
git fetch

for branch in $(git branch -r); do
    [[ $branch =~ origin/pr/ ]] && git merge $branch
done
like image 73
Harald Nordgren Avatar answered Sep 13 '25 07:09

Harald Nordgren