1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GNU stow で .gitignore のシンボリックリンクが作られない理由と解消法

Last updated at Posted at 2018-04-24

発端

私の dotfiles で、 stow git としても、 ~/.gitignore が作られませんでした。

stow -vvv git としたところ、以下のようなログになりました

stow dir is /Users/ndxbn/dotfiles
stow dir path relative to target /Users/ndxbn is dotfiles
cwd now /Users/ndxbn
cwd restored to /Users/ndxbn/dotfiles
cwd now /Users/ndxbn
Planning stow of package git...
Stowing contents of dotfiles/git (cwd=/Users/ndxbn)
Stowing dotfiles / git / .gitconfig
LINK: .gitconfig => dotfiles/git/.gitconfig
Planning stow of package git... done
cwd restored to /Users/ndxbn/dotfiles
Processing tasks...
cwd now /Users/ndxbn
cwd restored to /Users/ndxbn/dotfiles
Processing tasks... done

つまり、「 .gitignore は stow する対象にならなかったよ」ということです。

なぜ stow されなかったか

stow のドキュメント に、以下のようにかかれていました。

If neither the package-local or global ignore list exist, Stow will use its own built-in default ignore list, which serves as a useful example of the format of these ignore list files
もし、package-local な ignore list も global な ignore list もなかった場合、 Stow はビルトインのデフォルトの ignore list を使う。その内容を、 ignore list files の書き方のいち良例として示すな。(意訳)

# Comments and blank lines are allowed.

RCS
.+,v

CVS
\.\#.+       # CVS conflict files / emacs lock files
\.cvsignore

\.svn
_darcs
\.hg

\.git
\.gitignore

.+~          # emacs backup files
\#.*\#       # emacs autosave files

^/README.*
^/LICENSE.*
^/COPYING

なるほど、 .gitignore はデフォルトの ignore に含まれるんですね。

どう解決するか

stow のドキュメント に書かれているとおりにやればよいです。

今回の場合は、「dotfiles リポジトリは stow project なリポジトリ」と言えるので、 .stow-local-ignore をプロジェクトルートに置きました パッケージルートごとに置けるらしいので、 git パッケージルートに置きました

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?