What is the best way to submit PRs for multiple typos throughout a chapter? A single PR with a separate commit for each typo, or with a single commit with all the typos?
In general, you can put all your corrections in one commit and one PR, unless you are not sure for one particular correction (in which case you should put it in a separate commit/PR).
Do you have preferences for naming the PR/commit and style for listing the multiple changes in the PR notes?
We don’t have any guidelines on those, no, so whatever you like is good
Hi. I’m confused about how to use git to submit a PR to fastbook. Can someone help?
Here’s what I have done:
Create a fork at https://github.com/fastai/fastbook, using the web Fork button.
git clone https://github.com/PomoML/fastbook.git
git checkout -b new_branch
git remote add upstream https://github.com/fastai/fastbook
Now I have a current copy of fastbook on my local drive.
Next, over several days, I save suggested edits to file 01_intro.ipynb. I understand that the next steps are to commit the changes, push the edits to my online fork of the source repo, and to click on the “Create Pull Request” web button.
Here’s my question:
Suppose the original 01_intro.ipynb at github.com/fastai/fastbook has also been updated during that time.
Am I responsible for merging my edits into the newer file at the original source before submittimg a PR? How exactly do I do this?
Or are the owners of the original repo responsible for merging my edits that have been made on an older version? (That seems like a lot of extra work for them!)
Sorry if this question is dumb. I have found several articles that list the steps (all slightly different!), but none that illuminate the entire process.
Generally you would be responsible for the merge.
I am not sure what rules are followed for the
fastbook repo, but this is how I would try going about this.
- In your clone of the
fastbookrepo, go to the master branch
git checkout master
- See if you can pull the current version of the library (hopefully your master branch is tracking the
- Switch to your branch with changes, make sure they are all commited.
- I would then do this:
git rebase master
This will grab changes from your branch and replay them on top of master.
- If there are conflicts, I would fix them using a text editor, using
git statusto tell me where to look. Git should be giving you information on what commands to type in to proceed after you make the changes, but IIRC just adding the changes is enough (
git add .) and then continuing with the rebase.
- Once done, push your branch to your repo. The history on your local branch will be different than on the remote branch so you might need to do
git push --force <fork> <your_branch_name>
From there on, all you need to do is navigate to your repo on github and should have an option for opening a PR.
I probably should not post when I am so frustrated.
I decided to start with a simpler path because the original source has in fact changed more recently: fetch the current fastbook, redo my edits, quickly submit PR.
Clearly I do not get git, because no command I tried would bring the current fastbook master branch into either my github repo or the local one.
I tried pull, rebase, and fetch with all combinations of upstream and origin. Yes, it devolved into the random shotgun approach.
(git fetch upstream appeared to do some work, but my github and local repos still did not have the changes to the original source. The other commands said, “Already up-to-date”.)
I’m going to wipe everything and start again from the fork. Maybe I made some error in the process.
What I really would like is a step-by-step cookbook recipe, tested and verified for this specific situation. When I look for tutorials on the web, every one is different, and seasoned with “might”, “maybe”, and “perhaps you will need to”.
Thanks for listening. Excuse me while I go plant onions and squash.
I completely hear you. And yes, this is how git is - super powerful, super useful, but not intuitive. And what you are trying to do here is not really straightforward. But once you figure out how to navigate this, there is really not all that much more to git.
I found this course fun and very useful. Also, this book is really, really good. Sorry if this is not helpful - thought i’d share in case you or someone else might find this useful.
As I mentioned in the README, please refrain from making any PR for typos in fastbook right now as we are in the process of incorporating the (numerous) edits from the copywriter at O’Reilly back to the notebooks.