From 7698c747d77fef20f1037057df263510b7c665bc Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 14 Mar 2020 16:55:45 +0100 Subject: migrate git.txt + flatten hierarchy in SUMMARY --- git.txt | 104 ------------------------------------------------- src/SUMMARY.md | 33 +++++++--------- src/_ghost.md | 0 src/git.md | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 136 insertions(+), 122 deletions(-) delete mode 100644 git.txt delete mode 100644 src/_ghost.md create mode 100644 src/git.md diff --git a/git.txt b/git.txt deleted file mode 100644 index 2616d65..0000000 --- a/git.txt +++ /dev/null @@ -1,104 +0,0 @@ -# git ------------------------------------------------------------------------------------------------------------------------- - -# toc - |remote| - |branching| - |resetting| - |tags| - |diff| - |log| - |inspection| - |patching| - |submodules| - |revision_range| - - - *misc* - git add -p [] ......................... partial staging (interactive) - - - *remote* - git remote -v ............................... list remotes verbose (with URLs) - git remote show [-n] ............... list info for (like remote HEAD, remote branches, - tracking mapping) - - - *branching* - git branch [-a] ............................. list available branches; -a to include remote branches - git branch -vv .............................. list branch & annotate with head sha1 & remote tracking branch - git branch .......................... create branch with name - git checkout ........................ switch to branch with name - git push -u origin ................. push branch to origin (or other remote), and setup as - tracking branch - - - *resetting* - git reset [opt] - opt: - --mixed ................................. resets index, but not working tree - --hard .................................. matches the working tree and index to that of the tree being - switched to any changes to tracked files in the working tree since - are lost - git reset HEAD ....................... remove file from staging - git reset --soft HEAD~1 ..................... delete most recent commit but keep work - git reset --hard HEAD~1 ..................... delete most recent commit and delete work - - - *tags* - git tag -a -m "descr" ............... creates an annotated tag (full object containing tagger, date, ...) - git tag -l .................................. list available tags - git checkout tag/ .................... checkout specific tag - git checkout tag/ -b ......... checkout specific tag in a new branch - - - *diff* - git diff HEAD: origin/HEAD: ... diff files for different refs - git diff -U$(wc -l ) ......... shows complete file with diffs instead of usual diff snippets - - - *log* - git log --oneline ........................... shows log in single line per commit -> alias for '--pretty=oneline - --abbrev-commit' - git log --graph ............................. text based graph of commit history - git log --decorate .......................... decorate log with REFs - - - *inspection* - git ls-tree [-r] ...................... show git tree for , -r to recursively ls sub-trees - git show .............................. show - git cat-file -p ....................... print content of - - - *patching* - git format-patch / - opt: - -N ...................................... use [PATCH] even with multiple patches (default is [PATCH n/m] - where n is current commit num and m is total commit num in patch) - --start-number ...................... start output file generation with as start number instead '1' - since spcifier: - -3 ...................................... e.g: create a patch from last three commits - ............................ create patch with commits starting after - - git am .............................. apply patch and create a commit for it - - git apply --stat .................... see which files the patch would change - git apply --check ................... see if the patch can be applied cleanly - git apply ........................... apply the patch locally without creating a commit - - # eg: generate patches for each commit from initial commit on - git format-patch -N $(git rev-list --max-parents=0 HEAD) - - # generate single patch file from a certain commit/ref - git format-patch --stdout > my-patch.patch - - - *submodules* - git submodule add [] ............ add new submodule to current project - git clone --recursive ................. clone project and recursively all submodules (same as using - 'git submodule update --init --recursive' after clone) - git submodule update --init --recursive ..... checkout submodules recursively using the commit listed in the - super-project (in detached HEAD) - git submodule update --remote ...... fetch & merge remote changes for , this will pull - origin/HEAD or a branch specified for the submodule - - - *revision_range* - HEAD ........................................ last commit - HEAD~1 ...................................... last commit-1 - HEAD~N ...................................... last commit-N (linear backwards when in tree structure, check - difference between HEAD^ and HEAD~) - git rev-list --max-parents=0 HEAD ........... first commit - ------------------------------------------------------------------------------------------------------------------------- -vim:ft=help:sts=2:et:tw=120:cc=120:fo+=t - diff --git a/src/SUMMARY.md b/src/SUMMARY.md index d4ee8d9..b328af9 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -1,22 +1,19 @@ # Summary +- [git](./git.md) - [gdb](./gdb.md) -- [debug & trace](./_ghost.md) - - [strace](./strace.md) - - [lsof](./lsof.md) - - [pidstat](./pidstat.md) - - [time](./time.md) - - [pmap](./pmap.md) - - [pstack](./pstack.md) - - [perf](./perf.md) - - [OProfile](./oprofile.md) -- [binary](./_ghost.md) - - [od](./od.md) - - [xxd](./xxd.md) - - [readelf](./readelf.md) - - [objdump](./objdump.md) - - [nm](./nm.md) - - [c++filt](./c++filt.md) - - +- [strace](./strace.md) +- [lsof](./lsof.md) +- [pidstat](./pidstat.md) +- [time](./time.md) +- [pmap](./pmap.md) +- [pstack](./pstack.md) +- [perf](./perf.md) +- [OProfile](./oprofile.md) +- [od](./od.md) +- [xxd](./xxd.md) +- [readelf](./readelf.md) +- [objdump](./objdump.md) +- [nm](./nm.md) +- [c++filt](./c++filt.md) diff --git a/src/_ghost.md b/src/_ghost.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/git.md b/src/git.md new file mode 100644 index 0000000..8036303 --- /dev/null +++ b/src/git.md @@ -0,0 +1,121 @@ +# git(1) + +## Misc +```markdown + git add -p [] ............ partial staging (interactive) +``` + +## remote +```markdown + git remote -v .................. list remotes verbose (with URLs) + git remote show [-n] .. list info for (like remote HEAD, + remote branches, tracking mapping) +``` + +## branching +```markdown + git branch [-a] ................ list available branches; -a to include + remote branches + git branch -vv ................. list branch & annotate with head sha1 & + remote tracking branch + git branch ............. create branch with name + git checkout ........... switch to branch with name + git push -u origin .... push branch to origin (or other remote), and + setup as tracking branch +``` + +## resetting +```markdown + git reset [opt] + opt: + --mixed .................... resets index, but not working tree + --hard ..................... matches the working tree and index to that + of the tree being switched to any changes to + tracked files in the working tree since + are lost + git reset HEAD .......... remove file from staging + git reset --soft HEAD~1 ........ delete most recent commit but keep work + git reset --hard HEAD~1 ........ delete most recent commit and delete work +``` + +## tags +```markdown + git tag -a -m "descr" ........ creates an annotated tag (full object + containing tagger, date, ...) + git tag -l ........................... list available tags + git checkout tag/ ............. checkout specific tag + git checkout tag/ -b .. checkout specific tag in a new branch +``` + +## diff +```markdown + git diff HEAD: origin/HEAD: ... diff files for different refs + git diff -U$(wc -l ) ......... shows complete file with diffs + instead of usual diff snippets +``` + +## log +```markdown + git log --oneline .... shows log in single line per commit -> alias for + '--pretty=oneline --abbrev-commit' + git log --graph ...... text based graph of commit history + git log --decorate ... decorate log with REFs +``` + +## patching +```markdown + git format-patch / + opt: + -N ................... use [PATCH] instead [PATCH n/m] in subject when + generating patch description (for patches spanning + multiple commits) + --start-number ... start output file generation with as start + number instead '1' + since spcifier: + -3 .................. e.g: create a patch from last three commits + ........ create patch with commits starting after + + git am ......... apply patch and create a commit for it + + git apply --stat ... see which files the patch would change + git apply --check .. see if the patch can be applied cleanly + git apply .......... apply the patch locally without creating a commit + + # eg: generate patches for each commit from initial commit on + git format-patch -N $(git rev-list --max-parents=0 HEAD) + + # generate single patch file from a certain commit/ref + git format-patch --stdout > my-patch.patch +``` + +## submodules +```markdown + git submodule add [] .......... add new submodule to current project + git clone --recursive ............... clone project and recursively all + submodules (same as using + 'git submodule update --init + --recursive' after clone) + git submodule update --init --recursive ... checkout submodules recursively + using the commit listed in the + super-project (in detached HEAD) + git submodule update --remote .... fetch & merge remote changes for + , this will pull + origin/HEAD or a branch specified + for the submodule +``` + +## inspection +```markdown + git ls-tree [-r] .... show git tree for , -r to recursively ls sub-trees + git show ............ show + git cat-file -p ..... print content of +``` + +## revision_range +```markdown + HEAD ........ last commit + HEAD~1 ...... last commit-1 + HEAD~N ...... last commit-N (linear backwards when in tree structure, check + difference between HEAD^ and HEAD~) + git rev-list --max-parents=0 HEAD ........... first commit +``` -- cgit v1.2.3