CODEX

Git

Code Snippet Description
git reset <file>

unstage one file

git config --global [key] [value]

🌍 Global Scope: Saves the configuration to the ~/.gitconfig file (in your home directory). This is the default setting for all repositories under your user account (your personal laptop). Use this for your personal data (like user.name and user.email).

git config [key] [value]

📁 Local Scope: Saves the configuration to the .git/config file within the current repository. These settings override the global settings and only apply to this specific repository. Use this for your work data in your work repository.

git config --list

Display Current Repository Settings: Shows all configuration settings currently in effect for the active repository. This output combines the system, global, and local settings, reflecting the actual configuration being used, with local settings overriding global ones.

git config --global --list

Display Global Settings: Shows all configuration settings stored in the ~/.gitconfig file (the global scope). This lets you inspect your overall user defaults, independent of any specific repository's local overrides.

git checkout main
git branch --merged

This lists all branches that have been merged into the current branch (main in this case). If your branch appears in the list, it has been merged. If it doesn’t, it hasn’t been merged.

git branch -d [branchname]

Delete branch locally.
"-d" refuses to delete if it hasn’t been merged. If the branch has already been merged, it will delete without problem

git push origin --delete [branchname]

Removes the branch from the remote repository

git branch -r

List all remote branch

git branch -a

List all local AND remote branches. Remote branches are prefixed with "remotes/".

git checkout main
git pull origin main
git merge [branchname]
git push origin main

Merge completed branch into main and push main. Merged branch can be deleted. If needed, reverting is still possible without the branch.

git checkout -b <new-branch-name>

create a new branch

git push --set-upstream origin <branch-name>

When you create a new branch locally, Git doesn't automatically know where to push it on the remote server (origin). You need to tell it to create the branch on the remote and link your local branch to it.

Linux (Bash/Zsh)

Code Snippet Description
source venv/bin/activate

virtual environment activeren

Python - Flask

Code Snippet Description
flask run --debug
app.run(debug=True)

Allows running flask dev server and instantly see changes when reloading the page.
! A manual restart is needed in some cases.

Windows (CMD/PowerShell)

Code Snippet Description
venv\Scripts\activate

virtual environment activeren

tree /F /A > structure.txt

tree: displays the directory structure
/F: includes files (not just folders)
/A: uses ASCII characters (cleaner in txt files)
>: redirects the output
structure.txt: the output file

Export to CSV