As you edit files, Git sees them as modified, because you've changed them since your last commit. As you work, you selectively stage these modified files and then commit all those staged changes, and the cycle repeats.
Update, then WorkUpdate your local repo from the central repo ( git pull upstream master ). Make edits, save, git add , and git commit all in your local repo. Push changes from local repo to your fork on github.com ( git push origin master ) Update the central repo from your fork ( Pull Request )
I had the same problem on the Mac after cloning a repository. It would assume all files had been changed.
After running git config --global core.autocrlf input
, it was still marking all files as changed. After looking for a fix I came across .gitattributes
file in the home directory which had the following.
* text=auto
I commented it out and any other cloned repositories from now on were working fine.
I got it. All the other developers are on Ubuntu (I think) and thus have case-sensitive file systems. I, however, do not (as I'm on a Mac). Indeed, all the files had lowercase twins when I took a look at them using git ls-tree HEAD <path>
.
I'll get one of them to sort it out.
git config core.fileMode false
solved this problem in my case
https://git-scm.com/docs/git-config
TL;DR;
core.fileMode
If false, the executable bit differences between the index and the working tree are ignored; useful on broken filesystems like FAT. See git-update-index(1).
The default is true, except git-clone(1) or git-init(1) will probe and set core.fileMode false if appropriate when the repository is created.
I assume you are using Windows. That GitHub page you linked to has the details backwards. The problem is that CR + LF line endings have been committed to the repository already and because you have core.autocrlf set to either true or input, Git wants to convert the line-endings to LF, so git status
shows that every file is changed.
If this is a repository that you only want to access, but have no involvement with, you can run the following command to merely hide the issue without actually solving it.
git config core.autocrlf false
If this is a repository that you will be actively involved in and can commit changes to. You may wish to fix the problem by making a commit that changes all the line endings in the repository to use LF instead of CR + LF and then take steps to prevent it from happening again in the future.
The following is taken directly from the gitattributes man page and should be preformed from a clean working directory.
echo "* text=auto" >>.gitattributes
rm .git/index # Remove the index to force Git to
git reset # re-scan the working directory.
git status # Show files that will be normalized.
git add -u
git add .gitattributes
git commit -m "Introduce end-of-line normalization"
If any files that should not be normalized show up in git status
, unset their text attribute before running git add -u
.
manual.pdf -text
Conversely, text files that Git does not detect can have normalization enabled manually.
weirdchars.txt text
Please run the following commands. That might solve the issue.
# Remove everything from the index.
git rm --cached -r .
# Write both the index and working directory from git's database.
git reset --hard
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With