0
点赞
收藏
分享

微信扫一扫

git更新.gitignore文件

南柯Taylor 2022-07-12 阅读 141


首选:

git update-index --skip-worktree <file>

次选:

sudo git update-index --assume-unchanged <path&filename>

这两个有区别,具体看下面的参考文章,我还没深入看。

之前看有个朋友写git rm –cached .,这是不对的,这样会把所有缓存的文件都给删除掉!千万不要随意rm文件。

强制使用远程分支覆盖本地分支:

git fetch --all
git reset --hard origin/test_branch (这里master要修改为对应的分支名)
git pull

参考:
​​​https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore/20241145#20241145​​

​​http://fallengamer.livejournal.com/93321.html​​

​​http://blog.stephan-partzsch.de/how-to-ignore-changes-in-tracked-files-with-git/​​


举报

相关推荐

0 条评论