Python part I - More practice with variables, lists, and for loops
Assignment instructions:¶
The assignment this week lives inside a new jupyter notebook that has been added to the hackers-test/hack-5-python repository which you forked on github and cloned to your local machine for last weeks homework. Because we 'forked' this repository, the question arises, How do we get this new code into our own personal fork?
A note on git forks¶
When you create a 'fork' of a repository you are creating an exact copy of the original, and then disconnecting your fork from it from that point on (it's like a 'fork in the road'). In other words, the fork and the forked repo will almost certiainly begin to diverge as commits accumulate in one and not the other. Sometimes it is useful to 're-join' or pull in the commits from the upstream repository (the original forked repo), and this is what we will do here.
Syncing a fork to an upstream repository¶
Because the new homework lives in the repository that you originally forked from you must sync your repository to the original remote repo.
1 - Change directory to your local copy of the fork of the hack-5-python
repo
2 - Specify the original 'hack-5-python' repository as a new remote upstream for syncing
# View the currently attached remotes
$ git remote -v
origin https://github.com/iao2122/hack-5-python.git (fetch)
origin https://github.com/iao2122/hack-5-python.git (push)
# Add the upstream as a new remote
$ git remote add upstream https://github.com/hackers-test/hack-5-python.git
# Verify the new remote is set
$ git remote -v
origin https://github.com/iao2122/hack-5-python.git (fetch)
origin https://github.com/iao2122/hack-5-python.git (push)
upstream https://github.com/hackers-test/hack-5-python.git (fetch)
upstream https://github.com/hackers-test/hack-5-python.git (push)
3 - Merge the changes from upstream to your local forked copy
# Verify that you are on your local forks 'main' branch
$ git branch
* main
# If you are not on main you can switch to it like this:
$ git checkout main
# Now merge the upstream 'main' and your local 'main'
git merge upstream/main
# It may prompt you to include a message for the merge commit.
4 - Push the merge up to to the remote of your own fork
$ git push
5 - Start a jupyter notebook server locally.
6 - Navigate to ~/hacks/hack-5-python/notebooks/
7 - Complete the challenges in the new notebook nb-5.3-seesion5-challenges.ipynb
8 - Add, commit, and push changes back to your origin main
copy of the repo.
Resources¶
- Check in on the chatroom if you run into any problems.
- You can view a read-only version of the notebook assignments on nbviewer