categories | tags | Aimee's Blog
Aimee's Study Notes

It is updated automatically after each commit to the org-notes repo. It was last updated on Mar 01, 2021 00:18 UTC.

This page was created/modified in commit d39d9a6 "ssh" on 2021-02-22.
Markdown source of this page


categories: hacking

tags: git emacs orgmode


My cheatsheet about Git and Emacs.


Emacs & org-mode



Indent code: Ctrl + X, Tab, left/right

echo -e "test"

src_sh[:exports code]{echo -e "test"}

fn main()

~fn main()~

verbatim text

=verbatim text=

Git commands

Git tutorial

$ git show HEAD^  # to see the parent of HEAD
$ git show HEAD^^ # to see the grandparent of HEAD
$ git show HEAD~4 # to see the great-great grandparent of HEAD

Git commit log

It outputs a list of the email domains who have committed to the repository in the last 100,000 commits.

$ git log -n100000 --format="%ae" | cut -d@ -f2 | sort | uniq -c | sort -nr | less

Remote .git

$ ls .git
$ rm .git
rm: .git: is a directory
$ rm -rf .git

Download a file from command line

$ curl -LO
$ curl -L > ghost.svg

Cherry pick

$ git remote add some_github_id
$ git fetch some_github_id
$ git log some_github_id/master
$ git cherry-pick some_commit_hash
$ git diff HEAD^..HEAD
$ git push origin master

Reset a commit

$ git reset HEAD^
$ git rm */~
$ git rm */*~
$ git commit --amend
$ git log
commit ad8b178eb99e414f7eb298798acbe1317099cc1b (HEAD -> master)

More: Git Tools - Rewriting History

Hide changes and do not commit

$ git stash

Cancel hiding

$ git stash pop

Merge a PR and edit it

$ git remote add <someones_github_id><someones_github_id>/rust-in-blockchain.git
$ git fetch <someones_github_id>
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 8 (delta 4), reused 6 (delta 2), pack-reused 0
Unpacking objects: 100% (8/8), done.
 * [new branch]      master     -> <someones_github_id>/master # this one is on master branch

$ git merge <someones_github_id>/master

Add submodule to rib

$ ln -> means link

Creat an aliase for syncing file

$ ln -s ../awesome-blockchain-rust/

Recover to previous clean code

$ git checkout -f

About PATH

$ pwd
$ echo $PWD
$ export PATH=$PATH:$PWD


$ eval `ssh-agent`
$ ssh-add
$ ssh -T

Generated a new key

$ ssh-keygen -C

Copy it to GitHub settings:

$ cat ~/.ssh/

Move a file to current

$ git mv www/contracts .

This site is generated with ox-hugo for Emacs/Org-mode + hugo-bare-min-theme [Aimee's Study Notes]