Benutzer-Werkzeuge

Webseiten-Werkzeuge


snippets

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige ÜberarbeitungVorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
Nächste ÜberarbeitungBeide Seiten, nächste Überarbeitung
snippets [2017/11/15 01:22] – get-item $PWD ojdosnippets [2018/04/29 20:06] – log ojdo
Zeile 5: Zeile 5:
 ===== 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 (get-item $PWD).Name; magick mogrify -resize 3000x3000 -quality 80 -path (get-item $PWD).Name *.jpg%%''+==== Bash ==== 
 +<code bash>mkdir export && magick mogrify -resize 3000x3000 -quality 80 -path export *.jpg</code>
  
-===== Git aliases =====+==== PowerShell ====
  
-Heavy-branching-capable ''lg'' commandNot as commonly used ''ls'' short (no graphand ''ll'' long (file stats) forms''la'' is nice in that it lists all aliasesI hardly remember the ''d'' and ''dc'' aliasessadly. 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 
 + 
 +[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 ====
 +
 +My preferred ISO-inspired default date format, but without the unneeded precision of seconds. Date and time are split by a space, not the standard ''T'' which makes ''20010214T2359'' easier to parse, but harder to read. The graphColors allow to specify which of the (typically) 256 terminal colours are used to differentiate between different branches. Here I recommend using much more than the (randomly) chosen 5 values I have shown here.
 +
 +
  
snippets.txt · Zuletzt geändert: 2022/11/03 09:45 von ojdo