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

Setup SSH Key for Git services on Windows

Installing Git Git-scm.com Generating SSH key Open Terminal, type these and just hit Enter 1 ssh-keygen -t ed25519 It will generate a public key (id_ed25519.pub) and a private key (id_ed25519) in your home directory %userprofile%\.ssh. I’m gonna call it <private_file> and <public_file>.pub from now on. Create config file Navigate to %userprofile%\.ssh Create new text file and name it config.txt Add these lines Host <your_git_service>.com HostName <your_git_service>.com IdentityFile ~/.ssh/<private_file> IdentitiesOnly yes Save it and REMOVE THE ....

November 27, 2022 · 2 min · 309 words · Me