Skip to content

Instantly share code, notes, and snippets.

View brunohccz's full-sized avatar
🎯
Focusing

Bruno Cerciliar brunohccz

🎯
Focusing
View GitHub Profile
@joseluisq
joseluisq / stash_dropped.md
Last active August 5, 2024 08:36
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active September 23, 2024 20:37
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.