English 中文(简体)
取消对 Git 上所有文件的跟踪
原标题:Untrack all files on git
In the move from C9 to hosting on my Macbook via SSH, I ve had to re-download Kohana and change some other things just to get my site working; I don t want those to be committed. Is there any way to untrack all tracked files so only future changes are committed? Or is there something else I should be doing? I m on a Macbook running Mountain Lion with Apache and PHP turned on.
问题回答
Even simpler: cd /root/directory/of/your/local/repo git rm --cached -r . ^^^ (space - dot) Even even simpler: git clone url/for/Kohana /different/local/path
git rm --cached File Will delete the file in the index, so it will no longer be tracked, but won’t physically delete it. This will untrack the file only for current branch [OR] Use this git command. After you do this, git stops checking the file for possible modifications. git update-index --assume-unchanged At any time, you can track again by setting --no-assume-unchaged flag git update-index --no-assume-unchanged But these command do not affect the remote repository.
I m not exactly sure what you mean by "untrack all tracked files so only future changes are committed". As you need to track files so they can be committed. If all you just want to do is not track Kohana and the other downloads, then just remove them from your working directory using git rm --cached or even better create a .gitignore file. There are many helpful posts on stackoverflow to assist you with creating a .gitignore file for your project. By using this, you can exclude an entire folder easily. For Mac, it would also be helpful if you could see hidden file as the . file is hidden. This page shows you how to see hidden files on Mountain Loin - http://www.mikesel.info/show-hidden-files-mac-os-x-10-7-lion/
If you want to untrack a file, you can use git rm --cached -r . I forgot to add a .gitignore file and mistakenly tracked the node_modules directory, so I used the command git rm --cached -r node_modules to fix the problem.strong text




相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签