Ignore new commits for git submodule

后端 未结 6 552
执笔经年
执笔经年 2020-11-30 20:50

Background

Using Git 1.8.1.1 on Linux. The repository looks as follows:

master
  book

The submodule was created as follows:

6条回答
  •  甜味超标
    2020-11-30 21:47

    There are two kinds of change notices you can suppress (from git 1.7.2).

    The first is untracked content which happens when you make changes to your submodule but have not yet committed those. The parent repository notices these and git status reports it accordingly:

    modified: book (untracked content)
    

    You can suppress these with :

    [submodule "book"]
        path = modules/media
        url = https://user@bitbucket.org/user/repo.git
        ignore = dirty
    

    However, once you commit those changes, the parent repository will once again take notice and report them accordingly:

    modified:   book (new commits)
    

    If you want to suppress these too, you need to ignore all changes

    [submodule "book"]
        path = book
        url = https://user@bitbucket.org/user/repo.git
        ignore = all
    

提交回复
热议问题