https://learngitbranching.js.org/?locale=en_US
source /dev/stdin <<< "$(curl -sSL https://raw.githubusercontent.com/fzinfz/scripts/master/linux/git.init.sh)"
cat .git/HEAD # current branch headref: refs/heads/mastercat .git/ORIG_HEAD | xargs git show # prevous state of HEAD
working tree
don't include untracked files
git commit -am "save arezzo files"git commit --amend-c, --reedit-message <commit> # reuse and edit message from specified commit-C, --reuse-message <commit> # reuse message from specified commit
git log [<options>] [<revision-range>] [[--] <path>...]git show [<options>] <object>...git show [path] # details of last commit loggit log --since=2.weeks
git branch -a # list allgit checkout -b dev # create and checkout a new branchgit checkout devgit merge master--squash create a single commit instead of doing a merge--abort abort the current in-progress merge
https://www.atlassian.com/git/tutorials/resetting-checking-out-and-reverting
git checkout -- <file> # discard changes in working directorygit reset HEAD~2 # undo 2 changes that haven’t been sharedgit reset <paths> # opposite of `git add <paths>`--soft reset HEAD only--mixed reset HEAD and index (default)--hard reset HEAD, index and working tree--merge reset HEAD, index and working tree--keep reset HEAD but keep local changesgit revert HEAD~2 # undo 2 changes on a public branch
https://stackoverflow.com/questions/3639342
git reset mastergit checkout master
git stashgit stash listgit stash apply/popgit stash apply stash@{2}git stash dropgit stash drop stash@{0}
https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
git remote -vgit remote add [<options>] <name> <url>-f, --fetch fetch the remote branches--tags--no-tags-t, --track <branch> # branch(es) to track-m, --master <branch>--mirror[=<push|fetch>] # set up remote as a mirrocat .git/config`refspec`: +<src>:<dst><src> is the pattern for references on the remote side<dst> is where those references will be tracked locally[remote "origin"]fetch = +refs/heads/*:refs/remotes/origin/*fetch = +refs/heads/master:refs/remotes/origin/masterfetch = +refs/heads/foo/*:refs/remotes/origin/foo/*git push -u origin master:refs/heads/foo/masterpush = refs/heads/master:refs/heads/qa/mastertree .git/refs/.git/refs/├── heads│ ├── dev│ └── master├── remotes│ └── origin│ └── HEAD└── tagsgit push [<options>] [<repository> [<refspec>...]]-u, --set-upstream set upstream for git pull/statusgit pull origin master # fetch + merge
git push origin :topicgit push origin --delete topic
git config -l--global ~/.gitconfig--local .git/configcore.repositoryformatversion=0core.filemode=truecore.bare=falsecore.logallrefupdates=true--system /etc/gitconfig--get get value: name [value-regex]--get-all get all values: key [value-regex]--get-regexp get values for regexp: name-regex [value-regex]--get-urlmatch get value specific for the URL: section[.var] URL--replace-all replace all matching variables: name value [value_regex]--add add a new variable: name value--unset remove a variable: name [value-regex]--unset-all remove all matches: name [value-regex]git config --global push.default simplegit config --list --show-origin
git config --global http.proxy http://$IP:$Port
https://manishearth.github.io/blog/2017/03/05/understanding-git-filter-branch/
[--setup <command>][--env-filter <command>][--tree-filter <command>][--index-filter <command>][--parent-filter <command>][--msg-filter <command>][--commit-filter <command>][--tag-name-filter <command>][--subdirectory-filter <directory>][--original <namespace>][-d <directory>] [-f | --force] [--] [<rev-list options>...]
git rm --cached giant_file # leave it on diskgit commit --amend -CHEAD
git filter-branch --tree-filter 'rm -f filename' HEAD--all # all branchesgit filter-branch --index-filter \'git rm --cached --ignore-unmatch filename' HEAD
https://help.github.com/articles/removing-sensitive-data-from-a-repository/
https://git-scm.com/book/en/v2/Git-Branching-Rebasing
git remote add upstream https://github.com/yeasy/docker_practicegit fetch upstreamgit checkout mastergit rebase upstream/mastergit push -f origin master
https://git-scm.com/book/en/v2/Git-Tools-Submodules treat the two projects as separate yet still be able to use one from within the other.
https://developer.github.com/v3/repos/
curl -sSL https://api.github.com/repos/django/django/tags \| jq '.[0].zipball_url' | xargs -t wget -O file.zip
https://github.com/settings/tokens
curl -H 'Authorization: token INSERT_ACCESS_TOKEN_HERE' \-H 'Accept: application/vnd.github.v3.raw' -O -L \https://api.github.com/repos/owner/repo/contents/path
curl -sSL https://api.github.com/repos/ParsePlatform/Parse-SDK-Android/releases/latest \| jq '.zipball_url' | xargs -t wget -O file.zip
https://www.atlassian.com/dam/jcr:8132028b-024f-4b6b-953e-e68fcce0c5fa/atlassian-git-cheatsheet.pdf
curl -L https://github.com...?raw=true .html to page, etc: https://rawgit.com/ .js CDN: https://cdnjs.com/ https://cdn.jsdelivr.net/gh/user/repo@version/file .ipynb fast open: http://nbviewer.jupyter.org/
https://toolchain.gitbook.com/structure.html
book.json{"root": "./docs"}LANGS.md # https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes* [English](en/)* [Chinese](zh/)