首页 技术 正文
技术 2022年11月15日
0 收藏 455 点赞 3,972 浏览 1787 个字
30favorite

16

git 1.7.12

I want to mark all files below a given directory as assume-unchanged.

1) git update-index --assume-unchaged dir/ gives “Ignoring path.”

2) git update-index --assume-unchaged dir/* quickly fails because it will encounter files which are not being tracked, hence it gives “fatal: Unable to mark file” and quits.

3) Try generating a list of files to mark. cd into the desired directory and then run git ls-files | tr '\n' ' ' | git update-index --assume-unchanged. This produces no error message, but it does not successfully mark the files. The first portion of the command, git ls-files | tr '\n' ' ', correctly produces a space delimited list of all the files I want to mark. If I copy and paste the output of that command onto the command-line, then the git update-index command works. What is not working with the pipes?

No, it is not sufficient for me to add dir to .gitignore. I need these files to be in the repository, but undesired changes will be made locally that need to be ignored so that users can do pulls.

git command-line pipe

share|improve this question edited Sep 5 ’12 at 20:08   asked Sep 5 ’12 at 19:10git update-index –assume-unchanged on directory 转摘自:http://stackoverflow.com/questions/12288212/git-update-index-assume-unchanged-on-directorythoughtadvances
636816
  activeoldestvotes

share|improve this answer edited Jun 29 at 15:15   answered Sep 5 ’12 at 20:03git update-index –assume-unchanged on directory 转摘自:http://stackoverflow.com/questions/12288212/git-update-index-assume-unchanged-on-directorytwalberg
20.3k11928
 
2  
Excellent, thank you! The last command did indeed work. –  thoughtadvances Sep 5 ’12 at 20:09
    
Thank you so much! –  Mizmor Feb 22 ’13 at 19:37
    
FYI, that ` | tr ‘\n’ ‘ ‘` bit is unnecessary. –  Václav Slavík May 9 ’13 at 8:16
    
@VáclavSlavík You’re right… can’t remember why I put that in, other than for symmetry with the tr '\n' '\0' case (in which case it is needed)… –  twalberg May 9 ’13 at 14:01
2  
@twalberg: You could just use git ls-files -z –  Matthew Scharley Jul 22 ’13 at 1:35

share|improve this answer

answered Aug 7 ’13 at 18:56git update-index –assume-unchanged on directory 转摘自:http://stackoverflow.com/questions/12288212/git-update-index-assume-unchanged-on-directoryuser2661977
9111
  share|improve this answer answered May 17 ’13 at 14:11git update-index –assume-unchanged on directory 转摘自:http://stackoverflow.com/questions/12288212/git-update-index-assume-unchanged-on-directoryВиктор Перов
41419  
    
Instead of using cd, you can pass the dir as a final argument: git ls-files -- $DIR | xargs -l git update-index --assume-unchanged -- $DIR. –  kzh Mar 3 at 20:10

add a comment

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,083
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,558
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,407
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,180
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,817
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,900