Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 953
Jacob Avatar asked Jun 17 '13 05:06

Jacob


People also ask

What does it mean to untrack a file in git?

Untracked basically means that Git sees a file you didn't have in the previous snapshot (commit), and which hasn't yet been staged; Git won't start including it in your commit snapshots until you explicitly tell it to do so.

How do I Gitignore all files in a directory?

Put this . gitignore into the folder, then git add . gitignore . The * line tells git to ignore all files in the folder, but !.

How do you git add all untracked files?

The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area. We also say that they will be staged.


2 Answers

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  <filename>

At any time, you can track again by setting --no-assume-unchaged flag

git update-index --no-assume-unchanged  <filename>

But these command do not affect the remote repository.

like image 66
sinhayash Avatar answered Oct 03 '22 09:10

sinhayash


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
like image 33
VonC Avatar answered Oct 03 '22 09:10

VonC