Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige ÜberarbeitungNächste ÜberarbeitungBeide Seiten, nächste Überarbeitung |
snippets [2017/10/12 20:11] – [Convert pictures to lower resolution in subfolder] ojdo | snippets [2018/03/14 16:19] – added long git config paragraphs ojdo |
---|
===== Convert pictures to lower resolution in subfolder ===== | ===== Convert pictures to lower resolution in subfolder ===== |
| |
**Bash** ''%%mkdir export && magick mogrify -resize 3000x3000 -quality 80 -path export *.jpg%%'' | Using [[http://imagemagick.org/script/index.php|ImageMagick]] (version 7), this is a handy one-liner, ready to be integrated into an only slightly longer script, moving the result to a fixed, desired output location: |
| |
**PowerShell** ''%%mkdir export; magick mogrify -resize 3000x3000 -quality 80 -path export *.jpg%%'' | ==== Bash ==== |
| <code bash>mkdir export && magick mogrify -resize 3000x3000 -quality 80 -path export *.jpg</code> |
| |
===== Git aliases ===== | ==== PowerShell ==== |
| |
Heavy-branching-capable ''lg'' command. Not as commonly used ''ls'' short (no graph) and ''ll'' long (file stats) forms. ''la'' is nice in that it lists all aliases. I hardly remember the ''d'' and ''dc'' aliases, sadly. But then, typing them out does not hurt too much. | <code bash>mkdir (get-item $PWD).Name; magick mogrify -resize 3000x3000 -quality 80 -path (get-item $PWD).Name *.jpg</code> |
| |
| ===== Git config ===== |
| |
| First, the full configuration, then some comments by section: |
| |
| <code ini> |
| [color] |
| ui = auto |
| |
<code> | |
[alias] | [alias] |
lg = log --pretty=tformat:'%C(auto)%h %C(dim white)%cd %Creset%<(50,trunc)%s %C(bold blue)%aN%Creset%C(auto)%w(0,0,7)%+d%Creset' --decorate --graph --abbrev-commit --date=short | al = "!git config -l | grep "^alias" | cut -c 7-" |
ls = log --pretty=format:'%C(auto)%h %s %C(bold blue)%aN%C(auto)%d%Creset' --decorate | bl = for-each-ref --format='%(align:50,left)%(color:bold green)%(refname:short)%(color:reset)%(end)%0a %(color:dim green)%(objectname:short)%(color:reset) %(color:dim cyan)%(authordate:short)%(color:reset) %(color:cyan)%(authorname)%(color:reset) %(subject)%0a' --sort=-authordate refs/heads/ |
ll = log --pretty=format:'%C(auto)%h %C(dim white)%cd %Creset%s %C(bold blue)%aN%C(auto)%w(0,0,7)%+d%Creset' --decorate --name-status | ce = config --global --edit |
d = diff | d = diff |
dc = diff --cached | dc = diff --cached |
la = "!git config -l | grep "^alias" | cut -c 7-" | lg = log --pretty=tformat:'%C(dim white)%m%C(dim green)%h %C(dim cyan)%cd %C(reset)%<(50,trunc)%s %C(cyan)%aN%C(reset)%C(auto)%w(0,0,8)%+d%C(reset)' --decorate --graph |
| ll = log --pretty=format:'%C(dim white)%m%C(dim green)%h %C(dim cyan)%cd %C(reset)%s %C(cyan)%aN%C(auto)%w(0,0,8)%+d%Creset' --decorate --name-status |
| ls = log --pretty=format:'%C(dim white)%m%C(dim green)%h %C(dim cyan)%cd %C(reset)%s %C(cyan)%aN%C(auto)%d%Creset' --decorate --date=short |
| nl = "!author_names() { git log --pretty=format:'%aN' -- "${@-.}" | sort | uniq -c | sort -n -r; }; author_names" |
| |
| [merge] |
| tool = vimdiff |
| |
| [log] |
| date = format:%Y-%m-%d %H:%M |
| graphColors = 20,120,220,21,121,2 |
| |
| [push] |
| default = simple |
| |
| [core] |
| editor = vim |
</code> | </code> |
| |
| ==== Aliases ==== |
| |
| My main workhorse in day-to-day work is the ''lg'' (log graph) command, allowing for a quick overview on latest changes with ''git lg --all'' after a fetch. In case I want briefer output for a linear slice of commits, I use ''ls'' short (no graph). If I want to additionally see the changed files, ''ll'' (log long) can be used. Meta-alias ''al'' (alias list) does exactly that. |
| |
| Saying ''git dc'' instead of ''git diff --cached'' for a commit preview is very nice. I hardly remember the ''git d'' instead of ''git diff'', though. But then, typing that out does not hurt too much. Newcomer: ''bl'' (branch list) lists all local branches, together with its latest commit. It's designed to look similar to the output of ''lg''. I might extend it to output remotes in red; it already can list them by calling ''git bl refs/remotes''. |
| |
| The ''nl'' (name list) lists all commit authors for the current state (HEAD). The optional argument allows to specify a directory or file, by default it operates on the current working directory (''.''). Quite useful to quickly determine the contributors for a particular component. |
| |
| See chapter [[https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases|2.7 Git Basics - Git Aliases]] from the Git Book for other generally useful aliases. I kind of like ''unstage'', but have already embraced the concept behind ''reset HEAD'', so I am too late for that alias. |
| |
| |
| ==== vim ==== |
| |
| It's easier on the (ok, //my//) brain to switch from tool to tool without having to transfer from CLI to GUI window. But that's just opinion. |
| |
| ==== log ==== |
| |
| |