我希望在我的存储库中包含一个源文件(当有人克隆存储库时将其传送),但默认情况下会忽略它的更改.
git update-index --assume-unchanged ...不起作用,因为它只适用于本地索引.我希望所有用户默认忽略有问题的文件.
.gitignore不起作用,因为如果我通过跟踪文件git add -f ..,则会跟踪对它的更改.
我正在努力实现如果我svn add编辑文件然后svn:ignore编辑它会发生什么.
编辑:
看起来这在Git中是不可能的,我改变了源文件组织和构建依赖于这个旧的Subversion行为.
例子:
$ git clone git@git:gsmith/sandbox.git
snip...
$ cd sandbox/
$ ls -a
. .. .git .gitignore gitignored tracked
$ cat .gitignore
gitignored
$ echo foo >> gitignored
$ git status
# On branch 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)
#
# modified: gitignored
#
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
我想要忽略这个文件.
$ git reset --hard HEAD
HEAD is now at 34b1f3d initial setup
$ git rm gitignored
rm 'gitignored'
$ git commit -m "test"
[master cd8199d] test
1 files changed, 0 insertions(+), 1 deletions(-)
delete mode 100644 gitignored
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
$ ls -a
. .. .git .gitignore tracked
$ echo foo >> gitignored
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)
现在它被忽略了.但是,克隆存储库的人将无法获取其中的内容gitignored.
| 归档时间: |
|
| 查看次数: |
268 次 |
| 最近记录: |