Clean local branches except master|main|develop:
git branch | grep -v '\*\|master\|main\|develop\|staging\|production' | xargs -n 1 git branch -D
Execute a command using an specific ssh key:
git -c core.sshCommand="ssh -i ~/.ssh/id_ed25519" push origin main
Clone a project using an specific ssh key:
git -c core.sshCommand="ssh -i ~/.ssh/id_ed25519" clone [email protected]
Set ssh key per project:
git config core.sshCommand "ssh -i ~/.ssh/id_ed25519"
Changing committer name and email per repository
git config user.name "John Doe"
git config user.email "[email protected]"
Generate ssh PEM key for deploy keys
ssh-keygen -t rsa -m PEM
Reset author for all branch commits
git rebase -r --root --exec "git commit --amend --no-edit --reset-author"
Undo last local commit
$ git commit -m "Something terribly misguided" # (0: Your Accident)
$ git reset HEAD~ # (1)
[ edit files as necessary ] # (2)
$ git add . # (3)
$ git commit -c ORIG_HEAD # (4)
Mount remote folder using an specific ssh key
sshfs -o IdentityFile=/home/andres/.ssh/id_ed25519 USER@SERVER:/home/ubuntu .