CodeIgniter Forums
Git flow / contribution question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Git flow / contribution question (/showthread.php?tid=70089)



Git flow / contribution question - prezire - 02-18-2018

May I know how to proceed with an unfinished work? Let's say I wanted to push my contributution but I got stuck to an issue 90% along the way. How and where should I push my code to get some help? Should I do a PULL REQUEST? Where should other people who want to help me, push their solutions? Should they push it to my repo, or should they push to the original forked repo? Thanks!


RE: Git flow / contribution question - natanfelles - 02-18-2018

If you are working on something specific, people can open PR's on your fork. You can merge, if you accept.

Then open a PR in the original fork. If it is already open the changes will automatically go there when you do the merge.


RE: Git flow / contribution question - natanfelles - 02-18-2018

* if the merge is in the same branch of the PR


RE: Git flow / contribution question - prezire - 02-19-2018

So the issue really has to be solved in my own repo first before doing a PR to the original repo.

That means I need the contributors to fork my forked repo as well, correct?


RE: Git flow / contribution question - natanfelles - 02-19-2018

Starting from scratch, these are the basic steps:

Fork the Original repo on GitHub

[Image: J7vUdf9.png]

and after clone on your machine:


Code:
git clone [email protected]:prezire/CodeIgniter4.git CodeIgniter4


Enter the folder and see your current branch:

Code:
cd CodeIgniter4
git branch


You will see:


Code:
* develop


Add the Original CodeIgniter Repository as a remote repository:


Code:
git remote add upstream [email protected]:bcit-ci/CodeIgniter4.git


Check your remote repos:


Code:
git remote -v


You will see:

Code:
origin    [email protected]:prezire/CodeIgniter4.git (fetch)
origin    [email protected]:prezire/CodeIgniter4.git (push)
upstream    [email protected]:bcit-ci/CodeIgniter4.git (fetch)
upstream    [email protected]:bcit-ci/CodeIgniter4.git (push)


Update your current branch from the Original branch:


Code:
git pull upstream develop


Output:

Code:
From github.com:bcit-ci/CodeIgniter4
* branch              develop    -> FETCH_HEAD
* [new branch]        develop    -> upstream/develop
Already up to date.


Ok. Then you create a new branch to work in:


Code:
git checkout -b new_feature_x


Check the current branch:


Code:
git branch


Output:

Code:
 develop
* new_feature_x


Do your work. Edit, add what you want. Add the modified files to the stage and commit the changes:

Code:
git add system/filex.php system/filey.php
git commit -m "Message of the modifications"


Push to your fork:


Code:
git push origin new_feature_x


A new branch will be created on GitHub. Then will be possible to open a Pull Request:

[Image: QwHvnla.png]

Ok. If you opened the PR or not, but you stopped on a method and other developer want  to help you with. What he can do:

He can add your fork as a remote repo:


Code:
git remote add prezire [email protected]:prezire/CodeIgniter4.git


Then, he needs to fetch your custom fork:


Code:
git fetch prezire new_feature_x


And create a branch based on your fork:


Code:
git checkout -b prezire_new_feature_x prezire/new_feature_x


Ok. Then he's at the same point as you. Now he can help. He do what he think is necessary and add the files changed to stage, commit and push to his fork:


Code:
git push origin prezire_new_feature_x


Now, on GitHub, he will have the new branch "prezire_new_feature_x". And there he can open a PR to your fork:

[Image: Z6g8gsI.png]

Then, if you merge the changes, this automatically go to your PR on the original fork, if you created.

Ask your contributors to do commits with GPG-signed.

Read more: Contribution Guidelines


RE: Git flow / contribution question - prezire - 02-20-2018

But why so awesome though? Good reply. Thanks Nathan! :-)