8th April 2022
Computer Science⚑
GNULinux⚑
Git⚑
-
New: Move last n commits to a new branch.
So you forgot to create a feature branch ah? No problem, let's move the last few unpushed commits to a new branch:
git checkout -b new_branch # create a new branch from the current one git checkout old_branch # go back to the original branch git reset --hard HEAD~3 # undo the last 3 commits git checkout new_branch # go to the new branch and continue there
Programming⚑
Basics⚑
-
New: Enumerate().
To iterate over a list keys and values use
enumerate()
. Example:some_list = ['a', 'b', 'c'] for index, value in enumerate(some_list): ...
Logging⚑
-
New: Python logging.
Basic configuration:
import logging logging.basicConfig( format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S' ) logging.info('Just a random string...')