gitignore across all branches?

删除回忆录丶 提交于 2019-12-03 12:35:23

Add this to your $HOME/.gitconfig ;

[core]
    excludesfile = /path/to/your/local/.gitignore

Then it'll be locally available on all your git repositories.

If you created the gitignore file before creating the branches, it's obviously available in them. Otherwise you need to merge that file to other branches.

You can define a global ignore file with git config --global core.excludesfile [ignorefile].

macarthy

create a ~/.gitignore in your user directory

.DS_Store 
*.pyc 
.svn 

then run: git config --global core.excludesfile ~/.gitignore

  • Emacs files

    \#*#

Since 1.6.2, \ should be supported in .gitignore

  1. Check-in the .gitignore file. It is available across all the branches (unless you mess about with it) and keep it up to date with all your exclusions
  2. Use a global gitignore file.
  3. Add this to your gitignore file.

    #
    .#

I've written about the three ways of excluding files here.

Simplest way to get that file into all branches would be probably git cherry-pick commit with .gitignore file into those branches

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!