Git commands for everyday use

# Safely delete a local branch
git branch -d <branch_name>

# Delete a remote branch
git push origin --delete <branch_name>

# Prune local tracking branches not on the remote
git remote prune origin

# Remove the remote branch tracking on the local machine
git branch -dr origin/<branch_name>

# Merge a feature branch into one commit, squashing individual commits
git merge --squash <branch_name>

# Fetch updates from the remote repository
# and switch to a new or existing local branch that tracks a remote branch
git fetch
git switch -c <branch_name>