有没有可能`git add`一个当前由`assume-unchanged`保护的文件? [英] Is it possible to `git add` a file currently protected by `assume-unchanged`?

查看:100
本文介绍了有没有可能`git add`一个当前由`assume-unchanged`保护的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  git update- index --assume-modifying meta.xml 

是否可以强行 git添加meta.xml 而不必申请 no-assume-unchanged first?

解决方案>

git update-index --assmue-unchanged 和 git update- index --skip-worktree 会让git增加不可能。



这给你一个别名的定义,它会: p>

  git update-index --no-assume-unchanged 
git add - theFile
git update-index --assume - 不变

有些东西:

  addf =!f(){git update-index --no-assume-unchanged  -  $ 1; git add  -  $ 1; git update-index --assume -unchanged  -  $ 1}; f 


I have certain files that I rarely want new versions committed on but change often due to IDE settings.

git update-index --assume-unchanged meta.xml

Is it possible to forcibly git add meta.xml without having to apply no-assume-unchanged first?

解决方案

It doesn't seem possible: both git update-index --assmue-unchanged and git update-index --skip-worktree would make a git add impossible.

That leaves you with the definition of an alias, which would:

git update-index --no-assume-unchanged
git add -- theFile
git update-index --assume-unchanged

Something along the lines of:

addf = "!f() { git update-index --no-assume-unchanged -- $1; git add -- $1; git update-index --assume-unchanged -- $1}; f

这篇关于有没有可能`git add`一个当前由`assume-unchanged`保护的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆