generate key for access
ssh-keygen -t rsa -b 4096 -f github-id_rsa -C "Github"
mv github-id_rsa* ~/.ssh/
ssh-keygen -t ED25519 -f gitlab-id_ED25519 -C "Gitlab"
mv gitlab-id_ED25519* ~/.ssh/
Add to .ssh/config
Host github.com
Preferredauthentications publickey
IdentityFile ~/.ssh/github-id_rsa
Set email & name
git config user.email "first.last@example.com"
git config user.name "first last"
Fix old mode, new mode changes
git config core.filemode false
Commit without message
git commit -a --allow-empty-message -m ""
Adding upstream source
git remote add -f --no-tags -t master -m master upstream <repo>
git fetch upsteam
Checkout another remote
git fetch remote2
git checkout -b remote2-branch remote2/branch
Delete branch
git branch -d localBranchName
git push origin --delete remoteBranchName
Delete pushed commit
git push -f origin last_known_good_commit:branch_name
Deleting a pushed commit in the middle
master branch:
5c20bfa Commit 4
f0c7d8d Commit 3 - to delete
1463166 Commit 2 - to delete
9e0f65d Commit 1
31a0bbd Initial
git checkout 9e0f65d
git branch tmp
git checkout tmp
git cherry-pick 5c20bfa
git checkout master
git reset --hard 9e0f65d
git merge tmp
git push -f master
Remove sensitive file https://stackoverflow.com/questions/872565/remove-sensitive-files-and-their-commits-from-git-history
Pull all the repositories in a folder
find . \
-maxdepth 2 -type d \
-name ".git" \
-execdir python -c 'import os; print(os.path.abspath("."))' \; \
-execdir git branch \; \
-execdir git pull \;
brew cask install sourcetree
Clone a gist (this repo)
git clone git@gist.github.com:f1606275503fc7665eb1ad7c356ba2f5.git
Note: Gist does not support folder
Setup (Github)
- Open with
https://gitpod.io/
#https://github.com/user/repo
- Add .gitpod.Dockerfile, .gitpod.yml
Installing VS Code extension
- https://www.gitpod.io/docs/vscode-extensions/
- where to download: https://open-vsx.org/
Containers
- https://hub.docker.com/u/gitpod
- workspace-full source https://github.com/gitpod-io/workspace-images/tree/master/full
- ubuntu:focal