Skip to content

Instantly share code, notes, and snippets.

View ngohuytrieu's full-sized avatar
👨‍🍳
Coding is cooking

TRIEU NGO HUY ngohuytrieu

👨‍🍳
Coding is cooking
View GitHub Profile
@ngohuytrieu
ngohuytrieu / recover-deleted-branch.sh
Created June 7, 2023 10:06 — forked from umayr/recover-deleted-branch.sh
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}

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.
@ngohuytrieu
ngohuytrieu / moment-js-timezones.txt
Created May 16, 2022 15:10 — forked from diogocapela/moment-js-timezones.txt
List of All Moment.js Timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau