0

tl;dr : Git リポジトリのサブディレクトリにあるすべての作業コピーの変更を、リモートから削除せgit statusに、および友人の「追跡されていないファイル」および「削除されたファイル」にリストされないように、Git に永久に除外させる方法はありますか?元?

私はやむを得ず特定のファイルの名前を変更するシステムを使用していますが、リポジトリでは名前を変更すべきではありません。私はそれらのファイルを扱っていませんがgit statusgit diff出力が乱雑になっています。それらを追加して追跡され.gitignoreていないファイルの問題を解決しますが、それでもファイルが削除されたと表示されます.

好奇心旺盛な人のための長い説明と、私がこの質問をするべきではないと人々が言うのを避けるために:

私の作業コピーは、VM (VMware Fusion の Ubuntu) とホスト (Mac OS X) の両方からアクセスしようとしている共有フォルダーにあります。VM側でクローンを作成しました。VM の共有フォルダー機能は、ファイル システムに書き込まれるとすぐに任意のファイル名に置き換え:られます。これが OS X の認識方法です。&%問題は、職場の Git リポジトリに何百ものミッション クリティカルなファイルがあり、:ファイル名で、すべて1つの大きなディレクトリに。これらのファイルまたはそれらがすべて入っているディレクトリを編集または使用する必要はありませんが、Mac 側から GitX またはコマンド ライン ユーティリティを使用したいときはいつでも削除および追跡されていないファイルとして表示されます (これにより、 VM 用にすべての RAM を使い果たすことなく開発を行います)。それ以外は、Mac 上の git は他の変更を正しく認識し、この 1 つのディレクトリを除いて完全に機能します。ファイルの名前をコロンに戻すことはできません.OS Xでは違法であるためです(lsそうしようとすると壊れますmv.FWIW)。私が言及したもの以外の他の解決策は大歓迎です! ありがとう!

4

2 に答える 2

0

Try figuring out a different way to share the files between your VM and your host system, because both Ubuntu and Mac OS X allow colons in filenames.

I do not recommend AFP (the Mac's file sharing protocol), because the Linux client is broken and will map colons to slashes, making files with colons completely inaccessible, because the slashes will be interpreted as directory separators. (Yes, I filed a bug against afpfs.)

I do not recommend SAMBA either, I suspect the filenames are fairly limited for SAMBA.

But NFS works. It is very easy to set up on Mac OS X, the server programs are already installed, you just have to edit your exports file (/etc/exports, see man 5 exports) and turn the server on (nfsd enable). From Linux, mount the NFS share (mount host:/absolute/path). Done.

There are a couple issues you'll need to solve to get this working smoothly. Ideally, your user ID is identical on both systems -- it is probably 500 on your Mac and 1000 on Ubuntu. Edit /etc/passwd on Linux to fix this and chown -R username /home/username afterwards. (I did the opposite and changed the UID on my Mac to 1000, but my account disappeared from the login window. C'est la vie.) Your computer will probably have a gaping security hole unless you're careful with your exports file -- remember that NFS is not only unencrypted, but NFS servers trust their clients almost completely and do not ask for authentication (unless you use GSS, which is available in NFSv3 and standard in NFSv4, but GSS is a lot of work).

You can also do the opposite -- export NFS from Ubuntu and mount it on the Mac. Select "connect to server" in the Finder and enter nfs://host/absolute/path, it will appear as a volume.

于 2011-07-07T05:42:49.093 に答える
0

ファイル/パスが変更されたことを認識しないgit statusように、git ワークスペース内のパスを「未変更」としてマークすることができます。git diff例えば:

$ echo "default_value=Foo" > local.properties
$ git add local.properties
$ git commit -m'Default local.properties'

$ git update-index --assume-unchanged local.properties
$ echo "default_value=Bar" > local.properties
$ git status
# On branch master
nothing to commit (working directory clean)

パスに「assume-unchanged」ビットが設定されると、git はファイルへの変更を期待しなくなり、変更を報告しなくなります。

于 2012-02-21T20:03:48.603 に答える