<commit_before>---
layout: post
title: "在git hook中执行后台进程"
date: 2015-12-07 21:39:00
categories: snippet
tags: git
keywords: 
description: "howto: run background (time consuming) command in git hooks like post-receive"

---

18:46 < tg2arch> [Isaac Ge] 我在写根据当前 Git 目录下的 .gitignore 内容来查找出被引入 Git 的垃圾文件
18:46 < tg2arch> [Isaac Ge] 的脚本
18:47 < tg2arch> [farseerfc] 爲什麼不直接
18:47 < tg2arch> [farseerfc] git clean
18:48 < tg2arch> [Isaac Ge] 都被引入了
18:48 < tg2arch> [Isaac Ge] 都被 tracked 了
18:49 < tg2arch> [farseerfc] git rm --cached -n
18:50 < tg2arch> [farseerfc] git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached <commit_msg>add snippet for git cleaning files that should be ignored but tracked by fools<commit_after>---
layout: post
title: "Git清理本应ignore却被track的文件"
date: 2015-12-15 19:07:00
categories: snippet
tags: git
keywords: 
description: ""

---

来自 #archlinux-cn @freenode IRC 2015-12-15

```
18:46 < tg2arch> [Isaac Ge] 我在写根据当前 Git 目录下的 .gitignore 内容来查找出被引入 Git 的垃圾文件
18:46 < tg2arch> [Isaac Ge] 的脚本
18:47 < tg2arch> [farseerfc] 爲什麼不直接
18:47 < tg2arch> [farseerfc] git clean
18:48 < tg2arch> [Isaac Ge] 都被引入了
18:48 < tg2arch> [Isaac Ge] 都被 tracked 了
18:49 < tg2arch> [farseerfc] git rm --cached -n
18:50 < tg2arch> [farseerfc] git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached 
```
{'fraction_non_alphanumeric': 0.12954545454545455, 'fraction_numerical': 0.0893939393939394, 'mean_word_length': 4.305220883534137, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5711200', 'n_tokens_mistral': 701, 'n_tokens_neox': 622, 'n_words': 172}