Cheatsheet¶
virtualenv¶
- create
virtualenv [name-of-virtualenv]- include system’s Python packages
virtualenv [name-of-virtualenv] --install-site-packages- activate
source bin/activate- deactivate
deactivate
pip¶
- install
pip install [name-of-package]- install a particular version
pip install [name-of-package]==[version-number]- upgrade
pip install --upgrade [name-of-package]- uninstall
pip uninstall [name-of-package]- show what’s installed
pip freeze
git¶
- tell git who you are
git config --global user.email "you@example.com"git config --global user.name "Your Name"- clone a repository
git clone [repository URL]- checkout
git checkout [branch]switches to another branchgit checkout -b [new-branch]creates and switches to a new branchgit checkout -b [new-branch] [existing branch]creates and switches to a new branch based on an existing onegit checkout -b [new-branch] [remote/branch]creates and switches to a new branch based onremote/branchgit checkout [commit sha]checks out the state of the repository at a particular commit- current status of your local branches
git status- show the commit you’re on in the current working directory
git show- commit
git commit -m "[your commit message]"- add
git add [filename]adds a file to the staging areasgit add -u [filename]- the-uflag will also remove deleted files- remote
git remote add [name] [remote repository URL]sets up remotegit remote showlists remotesgit remote show -vlists remotes and their URLs- branch
git branchgit branch -ato show remote branches too- fetch
git fetchgets the latest information about the branches on the default remotegit fetch [remote]gets the latest information about the branches on the named remote- merge
git merge [branch]merges the named branch into the working directorygit merge [remote/branch] -m "[message]"merges the branch referred to into the working directory - don’t forget to fetch the remote before the merge- pull
fetchfollowed bymergeis often safer thanpull- don’t assume thatpullwill do what you expect it togit pullfetches updates from the default remote and merges into the working directory- push
git pushpushes committed changes to the default remote, in branches that exist at both endsgit push [remote] [branch]pushes the current branch to the namedbranchonremote- log
git logwill show you a list of commits
Notes¶
Throughout Git, anything in the form remote/branchname is a reference, not
a branch.
Documentation¶
- initialise Sphinx documentation
sphinx-quickstart- render documentation
make html