Useful git commands workflows - GlacioHack/xdem GitHub Wiki
Get the latest upstream state and create a branch without adding merge commits
git rebase
will rewrite the commits, this is to be used with caution, but prevents from adding merge commits every time which would make your fork diverge from upstream...
git checkout main
git fetch upstream main
git rebase upstream/main
git checkout -b yournewbranch
Push the changes and delete the branch locally and remotely
git push --set-upstream origin branch_name
git checkout main
git branch -d branch_name # delete your local branch
git push origin --delete branch_name # Delete the remote branch
Get all remote branches and clean deleted branches
git fetch --all --prune
If your fork has diverged from upstream and you want to reset it
Warning! This will delete all local commits that are not in remote !
git checkout main
git reset --hard upstream/main
git push -f