git跟踪,忽略,删除,追踪 [英] git track, ignore, delete, untrack
问题描述
我似乎通过跟踪一个文件而忽略了它,然后删除它,从而让我的git repo变得更加糟糕。事情是,我希望该文件存在于远程存储库(即时网站)中,但不想跟踪。
现在,我的主分支正在尝试从存储库中删除所有文件,我知道在我推送更改时会在远程分支上删除它们...我只是想以解开它们,但不能这样做,因为它们已经在master和git上删除了。rm -r --cached说'没有匹配任何文件'。
我解开这些被删除的文件而不将它们从远程存储库中删除?
你只是不想跟踪文件,但您希望将该文件保存在远程存储库(非裸露)中。
使用此git命令。这样做后,git会停止检查文件是否有可能的修改。
git update-index --assume-unchanged< filename> ;
在任何时候,您都可以通过设置 - no-assume-unchaged flag
git update-index --no-assume-unchanged< filename>
这些命令不会影响远程存储库。
更多信息: http ://kar-git.blogspot.in/2012/11/how-to-set-git-to-ignore-few-files-like.html
I seem to have ballsed up my git repo by tracking a file, later ignoring it and then deleting it. The thing is, I want the file to be present in a remote repository (the live site), but just don't want to track.
Now my master branch is trying to remove all the files from the repository, which I know will delete them on the remote branch when I push changes... I just want to untrack them, but cannot do that as they're already deleted on master and git rm -r --cached says 'did not match any files'.
How can I untrack these deleted files without removing them from the remote repository?
You just don't want to track a file, but you want to keep the file in the remote repository (non-bare).
Use this git command. After you do this, git stops checking the file for possible modifications.
git update-index --assume-unchanged <filename>
At any time, you can track again by setting --no-assume-unchaged flag
git update-index --no-assume-unchanged <filename>
These command do not affect the remote repository.
For more information: http://kar-git.blogspot.in/2012/11/how-to-set-git-to-ignore-few-files-like.html
这篇关于git跟踪,忽略,删除,追踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!