Skip to content

Instantly share code, notes, and snippets.

@kandersolar
Last active February 25, 2022 13:40
Show Gist options
  • Select an option

  • Save kandersolar/dd1f2b5d991b6486a889971e13f9ae8b to your computer and use it in GitHub Desktop.

Select an option

Save kandersolar/dd1f2b5d991b6486a889971e13f9ae8b to your computer and use it in GitHub Desktop.
Cheat sheet for conda envs, git, et al

Conda

  • create a new environment
    conda create -n myenv python=3.7
  • delete an environment
    conda env remove --name myenv
  • show environments
    conda env list

Git tagging

  • create a tag
    git tag -a v0.1 -m "notes about the tag" af48faf
  • push tags to remote
    git push origin --tags
  • delete a tag locally
    git tag -d v0.1
  • delete a tag remote
    git push origin --delete v0.1

Git (misc)

  • make local copy of upstream PR branch:
    git fetch upstream refs/pull/PR_NUMBER/head:LOCAL_BRANCH_NAME
  • list contributors between two tags (or branches/hashes)
    git shortlog -s -n 1.0.0..2.0.0
  • git grep, excluding a folder
    git grep -F my_search_string ":(exclude)docs/**"
  • install from a github branch
    pip install git+https://github.com/kanderso-nrel/pvfactors.git@sparse

Markdown

  • Collapsible section (source):

    <details>
      <summary>Click to expand!</summary>
    
    ```python
    print('Hello, world!')
    ```
    </details>
    

Pytest

  • Turn warnings into errors
    pytest pvlib/tests/test_modelchain.py -W error::pvlib._deprecation.pvlibDeprecationWarning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment