Clearing old commits from a repository

Use case A repository that hosts a static website. Steps Creating a new branch 1 git checkout --orphan latest_branch Adding files to the new branch 1 2 git add -A git commit -am "update" Deleting the old branch 1 git branch -D main Renaming the new branch 1 git branch -m main Force push to the remote repository 1 git push -f origin master References How can I delete old commits in Github via terminal?...

December 13, 2022 · 1 min · 79 words · Me

How to automatically sign commits with SSH key

Generating a new SSH key Read this to learn how to generate a public/private key pair. Adding the SSH key to your GitHub account Profile > Settings > SSH and GPG keys > New SSH key Enter a title of your choice and the public key. Change key type to Signing key and click Add SSH key. Configuring Git to sign commits by default 1 2 3 git config --global commit....

December 12, 2022 · 1 min · 97 words · Me