11 Aralık 2009, Cuma
görmezden git-diff ^M
Bazı dosyalar yeni satır ayırıcılar olarak ^M içeren bir proje. Bu dosyalar Diffing git-diff tüm dosya sadece tek bir satır olarak görüyor, çünkü görünüşe göre imkansız.
Nasıl bir önceki sürüm ile fark ediyor mu?
Orada bir seçenek gibi "^M diffing olarak yeni satır" ? zevktir
prompt> git-diff "HEAD^" -- MyFile.as
diff --git a/myproject/MyFile.as b/myproject/MyFile.as
index be78321..a393ba3 100644
--- a/myproject/MyFile.cpp
b/myproject/MyFile.cpp
@@ -1 1 @@
-<U FEFF>import flash.events.MouseEvent;^Mimport mx.controls.*;^Mimport mx.utils.Delegate
\ No newline at end of file
<U FEFF>import flash.events.MouseEvent;^Mimport mx.controls.*;^Mimport mx.utils.Delegate
\ No newline at end of file
prompt>
GÜNCELLEME:
şimdi son 10 düzeltmeleri kontrol eder ve CR LF dönüştüren bir script yazdım.
require 'fileutils'
if ARGV.size != 3
puts "a git-path must be provided"
puts "a filename must be provided"
puts "a result-dir must be provided"
puts "example:"
puts "ruby gitcrdiff.rb project/dir1/dir2/dir3/ SomeFile.cpp tmp_somefile"
exit(1)
end
gitpath = ARGV[0]
filename = ARGV[1]
resultdir = ARGV[2]
unless FileTest.exist?(".git")
puts "this command must be run in the same dir as where .git resides"
exit(1)
end
if FileTest.exist?(resultdir)
puts "the result dir must not exist"
exit(1)
end
FileUtils.mkdir(resultdir)
10.times do |i|
revision = "^" * i
cmd = "git show HEAD#{revision}:#{gitpath}#{filename} | tr '\\r' '\\n' > #{resultdir}/#{filename}_rev#{i}"
puts cmd
system cmd
end
CEVAP
11 Aralık 2009, Cuma
Git-ele repo yalnızca yeni satır karakteri \n kullandığınızdan emin olun Github suggests. Otomatik dönüştürmek için bir seçenek var:
$ git config --global core.autocrlf true
Tabii ki, bu cr lf dönüştürmek istediğiniz süre crlf lf dönüştürmek " dedi. İşe yarar umarım
Ve sonra dosyalarını dönüştürmek:
# Remove everything from the index
$ git rm --cached -r .
# Re-add all the deleted files to the index
# You should get lots of messages like: "warning: CRLF will be replaced by LF in <file>."
$ git diff --cached --name-only -z | xargs -0 git add
# Commit
$ git commit -m "Fix CRLF"
çekirdek.autocrlf the man page üzerinde açıklanmıştır.
Bunu Paylaş:
Nasıl diff ---uzay-görmezden değiştirm...
Git diff -w görmezden başlangıç ve bit...
Git diff çıktısı okumak için nasıl`?...
Neden Krom yerel jQuery çerez görmezde...
git diff fark tamamlar...