Skip to content

Learning log

Linda edited this page Feb 29, 2020 · 7 revisions

General learnings

  • OMG dockerizing everything actually does make setup easier. @bengineerdavis, @d3vild06, and everyone who asked about it: you were right. (Linda)
  • querysets() are lazy. The result of a query from a DB is inherently unordered. If I have three different querysets() that each pull an attribute from an object in a model at different times, zip()-ing them together without sorting them will not put each associated attribute together with its siblings. (Bethany)

How do I check out a PR from a fork?

If you need to "check out" a master branch PR from a forked repo (e.g. checking out a PR submitted fromo https://github.com/billglover/django-concept), the way to do it is:

1/ git remote add bill https://github.com/billglover/django-concept.git 2/ git fetch bill 3/ git checkout bill/master 4/ Then you can git checkout -b a new local branch while you are there so that you can save any commits, push it up, and then create a PR on Blil’s repo.

References: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork https://www.atlassian.com/git/tutorials/syncing/git-fetch

^ That second link explains steps 3 and 4 more clearly:

Note: checking out coworkers/feature_branch'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>```

## How do I back out of a migration? (Linda)
The best reference (with ~737 upvotes): https://stackoverflow.com/questions/32123477/how-to-revert-the-last-migration

## What are some common docker commands? (Linda)
I never actually really bothered to learn docker before (hah) so picked up a couple of commands that felt useful: 

- list all the containers running

$ docker ps

- How to pull a docker postgres image (specifically postgres 11.1)

$ docker pull postgres:11.1

- See all the images you have

$ docker images

- The place your postgres image probably exists

`$HOME/docker/volumes/postgres`

- How to prune your docker system of all unused volumes (I think?)

$ docker system prune --all --volumes

Clone this wiki locally