Вопрос:
Проблема 1.
Я пытаюсь позволить git отслеживать файл “altro.src”, но безуспешно. Файл полностью игнорируется git, даже если он не указан в .gitignore, он не отображается с –ignored и даже если я пытаюсь выполнить git -add, он не рассматривается.
Я новичок с git (третья фиксация… и я уже застрял), но у меня есть большой опыт работы с hg.
Вот несколько команд, чтобы показать проблему:
$ ls -al altro.src -rw-r—r— 1 myuser staff 560 28 Mar 09:02 altro.src $ git status . On branch master Your branch is up-to-date with ‘origin/master’. Changes not staged for commit: (use «git add <file>…» to update what will be committed) (use «git checkout — <file>…» to discard changes in working directory) typechange: moebius.html no changes added to commit (use «git add» and/or «git commit -a») $ cat .gitignore *~ .DS_Store /index.html /index.en.html /moebius.html /moebius.en.html /altro.html /altro.en.html $ git status . —ignored On branch master Your branch is up-to-date with ‘origin/master’. Changes not staged for commit: (use «git add <file>…» to update what will be committed) (use «git checkout — <file>…» to discard changes in working directory) typechange: moebius.html Ignored files: (use «git add -f <file>…» to include in what will be committed) .DS_Store .gitignore~ altro.en.html altro.html altro.src~ base.src~ build_site.py~ index.en.html index.html moebius.en.html moebius.src~ no changes added to commit (use «git add» and/or «git commit -a») $ git add altro.src $ git status . On branch master Your branch is up-to-date with ‘origin/master’. Changes not staged for commit: (use «git add <file>…» to update what will be committed) (use «git checkout — <file>…» to discard changes in working directory) typechange: moebius.html no changes added to commit (use «git add» and/or «git commit -a»)
Проблема 2. Я не понимаю, что означает “typechange” в файле moebius.html и как избавиться от этого сообщения (moebius.html находится в моем .gitignore, и я хочу, чтобы его игнорировали).
Лучший ответ:
Я подозреваю, что altro.src не изменился, так как вы проверили его ранее. Git не предупреждает вас, если вы попытаетесь создать неизменный файл, но он не добавит его в промежуточную область (индекс), чтобы он не отображался в git status. Другими словами, если вы попросите Git добавить что-то, что уже есть, оно не должно работать.
Вы можете проверить это, запустив git diff altro.src (может не отображаться никаких изменений) и git log altro.src (чтобы увидеть, какая из ваших коммиттов добавила его раньше).
Заметка типа change сообщает вам, что тип файла был изменен (например, из обычного файла в ссылку на файл).