Set project environment, Git version control and connect to GitHub from terminal prompt

Essential Anaconda Prompt commands to setup environment, git and connect with GitHub

Anaconda Prompt
Anaconda Prompt

1. Introduction

1.1. Initial motives to start using terminal

1.2. Additional inspirations

Python Tutorial: How I Manage Multiple Projects, Virtual Environments, and Environment Variables
Should You STOP Using an IDE?
Version control using Git and GitHub

2. Terminal essentials

2.1. Miniconda3

(base) C:\Users\Albert>

2.2. Basic commands to operate inside prompt

3. Environment setup

3.1. Create a new environment (step by step)

conda create --name env_name  # creates an empty environment (1)
# requires confirmation to proceed conda activate env_name # launch env_name in the terminal (2)
conda install python # install latest python version (3)
# requires confirmation to proceed

3.2. Create new environment (compact)

conda create --name new_env python numpy=1.20.1 pandas matplotlibconda activate new_env

3.3. Other useful commands

3.4. Document environment details

pip freeze > requirements.txtconda env export > environment.yml

3.5. Environment setup conclusion and further references

4. Git

4.1. Initial git setup

5. Start a project

Hand Tracking example project

5.1. Set project location

(base) C:\Users\Albert>d:  # switch drive(base) D:\>mkdir d:\Python\HandTracking
(base) D:\>cd Python\HandTracking
(base) C:\Users\Albert>mkdir d:\Python\HandTracking
(base) C:\Users\Albert>cd /d d:\python\handtracking

5.2. Create a new environment and install packages

conda create --name HandTracking python opencv-python mediapipe
conda create --name HandTracking pythonconda activate HandTrackingpip install opencv-python
pip install mediapipe

5.3. Create/modify a file for your project


5.4. Initialise version control

(HandTracking) d:\Python\HandTracking>git init
git status  # returns the status of the project

5.5. Commit changes

git add
Initial commitAdded which access camera and detects hands in img

5.6. Track changes with git log

(HandTracking) d:\Python\HandTracking>git log[master (root-commit) ab16631] Initial commit
1 file changed, 33 insertions(+)
create mode 100644
(HandTracking) d:\Python\HandTracking>git log
commit ab1663193e25ee07c6b5ff419c75cb0a2ef88930 (HEAD -> master)
Author: Albert <>
Date: Wed Jun 2 16:19:49 2021 +0100
Initial commit Added which access camera and detects hands in img

6. Connect Git with GitHub

6.1. Initialise a new GitHub repository

git clone

6.2. Master branch vs. Main branch

# rename branch
git branch -m master main
(HandTracking) d:\Python\HandTracking>git status
On branch main
nothing to commit, working tree clean
git config --global init.defaultBranch main 

6.3. Connecting local repository with GitHub

git remote add origin
git branch -M main
git push -u origin main

7. Further commits

8. Conclusions