I'm sure there are ton of documentation, but nothing appear clear to me.
I want to contribute to opensource projet, do a real PR for the first time. (Late is Better than Never).
To start easy, I just want to take the work someone did on a github fork (but didn't push back to the master), do some small update and then try to make a PR to the original repository
The Master Repo is (R1):
The Forked and Updated Repo is (R2): (Attention : in a specific Branch)
I forked the ageneau repo on my account
My intent is :
To do a Fork of R2 the on my github account = I did't succeed. It always fork me the R1 without the interesting branch. What to do ? I fact I already add the R1 Fork. So I deleted the R1 fork and the succeed to fork R2 on my Github
Then get a local repo:
git clone https://github.com/afaucogney/loopback-sdk-android.git
Add the origin
git init
git remote add origin https://github.com/afaucogney/loopback-sdk-android.git
Add the upstream (Strongloop version)
git remote add origin https://github.com/strongloop/loopback-sdk-android.git
Create local branch
cd loopback-sdk-android
git branch firstpr
git checkout firstpr
Then what to do, I would expect
git rebase origin upstream... but nothing interesting happen.
Please advise me on the process as well as git command.
Let see a very detailed worked:
Fork on Github the repo that provide the solution by clicking on "Fork" button:
So you get a fork in your Github (called here R3) account like:
In Github, do a Pull Request:
Where:
Like that (with all the commits done by Strongloop since the Ageneau Fork):
Click on "Create Pull Request":
The PR cannot be automatically merged:
Clone the branch on your local compute (Be careful, the procedure is different that the one proposed by Github). Use
--branch <branch-name>
to clone a specific branchgit clone https://github.com/MilleZimTech/loopback-sdk-android.git --branch fix_flatten
cd loopback-sdk-android
git branch
You should see the 'fix_flatten' branch
Create a new branch with the master repo in it:
git checkout -b strongloop-master fix_flatten
git pull https://github.com/strongloop/loopback-sdk-android.git master
In case of conflict.
git status
shows you the file that are modified or not.git add .
adds new files.git commit -am"merge fix_flatten master"
commits the change.Again
git pull https://github.com/strongloop/loopback-sdk-android.git master
Switch the
fix_flatten
branchgit checkout fix_flatten
Merge both branches without FastForward merge
git merge --no-ff strongloop-master
You should see :
Push back to Github repo
git push origin fix_flatten
In case you clone the repo with git:// and not https:// you need to :
git remote set-url --push origin https://github.com/MilleZimTech/loopback-sdk-android.git
, use the--push' because without, only the
fetch` argument of the origin repository will be updated.and again
git push origin fix_flatten
Then see the changes on Github like
As this is the fix_flatten branch that is up to date, do a pull request on master branch on my repo.
Select the
fix_flatten
branch, then we can see:Click on PullRequest
master
branchfix_flatten
branchMerge and Confirm the PullRequest
Then you can PullRequest safely Strongloop repo
End :
Ouuuf... this was hard to find and describe. But I think this can help someone that doesn't know well git. Never the less, I cannot understand why this has been so complicated and long.
Does anyone has a more direct way to do such usual task ?