Git adding "unchanged" files to the stage

15,819

Solution 1

check your .gitignore file there must be some pattern matching this file which is excluding file from being staged. Or you can use git add . -f to forcely add these files.

Solution 2

It seems like the assume-unchanged-bit is set for that file. With that bit set, git will not look for changes of that file anymore. Unset it by typing:

git update-index --no-assume-unchanged <file>

After that, git status as well as git add should detect the changed file.

Share:
15,819

Related videos on Youtube

user2744374
Author by

user2744374

Updated on September 09, 2022

Comments

  • user2744374
    user2744374 over 1 year

    For a project I'm working on, I want to use:

    git add . -A
    

    to add some files to the stage. The problem is that Git thinks these files are unchanged from the last commit, so they are ignored. However, I personally changed the file, but Git still sees the file as unchanged.

    How can I "forcefully" add that single file to my repository?

  • Edward Thomson
    Edward Thomson over 8 years
    No, a .gitignore only affects files when they're detected as untracked - ie, when they are not yet in the repository. Once a file is in the repository, a .gitignore will not apply to it.