Я могу использовать разность мерзавца на неотслеженных файлах?

Добавление свойств в prototype означает, что вы хотите создать объект, используя функцию в качестве конструктора.

Когда вы создаете объект, например, вызывая new для функции, значение this является новым создаваемым объектом. Так что нет смысла bind this к другому значению.

242
задан Steven Penny 13 July 2014 в 13:32
поделиться

2 ответа

With recent git versions you can git add -N the file (or --intent-to-add), which adds a zero-length blob to the index at that location. The upshot is that your "untracked" file now becomes a modification to add all the content to this zero-length file, and that shows up in the "git diff" output.

git diff

echo "this is a new file" > new.txt
git diff

git add -N new.txt
git diff
diff --git a/new.txt b/new.txt
index e69de29..3b2aed8 100644
--- a/new.txt
+++ b/new.txt
@@ -0,0 +1 @@
+this is a new file

Sadly, as pointed out, you can't git stash while you have an --intent-to-add file pending like this. Although if you need to stash, you just add the new files and then stash them. Or you can use the emulation workaround:

git update-index --add --cacheinfo \
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 new.txt

(setting up an alias is your friend here).

245
ответ дан 23 November 2019 в 03:12
поделиться

Я считаю, что вы можете сравнивать файлы в вашем индексе и неотслеживаемые файлы, просто указав путь к обоим файлам.

git diff --no-index tracked_file untracked_file
85
ответ дан 23 November 2019 в 03:12
поделиться
Другие вопросы по тегам:

Похожие вопросы: