.gitignore /folder vs folder/

前端 未结 3 1366
后悔当初
后悔当初 2021-02-05 18:10

in .gitignore what is the difference between using

/bin

and

bin/

And how would I make it so that it removes a

3条回答
  •  遥遥无期
    2021-02-05 18:25

    A leading / anchors the ignore pattern at the point in the tree where the particular .gitignore resides.

    A trailing / means that a pattern will only match a directory (and so all the files in that matching directory).

    You can have both, e.g. /bin/ will match only a directory called bin and only at the level of the .gitignore file.

    A simple *.ext will match any file ending with .ext anywhere at or below the level of the .gitignore file in which it appears.

提交回复
热议问题