diff options
author | johannst <johannes.stoelp@gmail.com> | 2019-11-08 17:30:35 +0100 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2019-11-08 17:30:35 +0100 |
commit | 2bb3f0d8d3bb45a4fec87d04e83b4fc7a6bd25cd (patch) | |
tree | 1b342776cbec30447f4303183a3842a679a873a0 | |
parent | 8e2332bfc68fb040a956226d36f1ef71c944ef82 (diff) | |
download | notes-2bb3f0d8d3bb45a4fec87d04e83b4fc7a6bd25cd.tar.gz notes-2bb3f0d8d3bb45a4fec87d04e83b4fc7a6bd25cd.zip |
added git my git cheatsheet
-rw-r--r-- | debug.txt | 6 | ||||
-rw-r--r-- | git.txt | 67 |
2 files changed, 73 insertions, 0 deletions
@@ -19,6 +19,12 @@ lsof +fg -p <pid> # compared to /proc/<>/maps it shows the size of the mappings pmap <pid> +# trace minor/major page faults +pidstat -r -p <pid> [interval] + +# statistics of process run +/usr/bin/time -v <cmd> + # get supported events perf list @@ -0,0 +1,67 @@ +/* git help */ + + - remote + git remote -v list remotes verbose (with URLs) + git remote show [-n] <remote> list info for <remote> (like remote HEAD, remote branches, tracking mapping) + -n show available info without contacting remote (offline mode) + + - 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 <bname> create branch with name <bname> + git checkout <bname> switch to branch with name <bname> + git push -u origin <rbname> push branch to origin (or other remote), and setup <rbname> as tracking branch + + - resetting + git reset [type] <ref|commit> + type: + --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 <commit> are lost + git reset HEAD <file> 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 <tname> -m "descr" creates an annotated tag (full object containing tagger, date, ...) + git tag -l list available tags + git checkout tag/<tname> checkout specific tag + git checkout tag/<tname> -b <bname> checkout specific tag in a new branch + + - diff + git diff HEAD:<fname> origin/HEAD:<fname> diff files for different refs + git diff -U$(wc -l <fname>) <fname> 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 + + - patching + git format-patch <opt> <since>/<revision range> + 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 <n> start output file generation with <n> as start number instead '1' + since spcifier: + -3 e.g: create a patch from last three commits + <comit hash> create patch with commits starting after <comit hash> + + git am <patch> apply patch and create a commit for it + + git apply --stat <PATCH> see which files the patch would change + git apply --check <PATCH> see if the patch can be applied cleanly + git apply <PATCH> 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 <COMMIT/REF> --stdout > my-patch.patch + + - <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 + |