Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear git caches?

Tags:

git

When I list my branches with git branch -a, git shows me remote branches I can't actually find on my remote(gitlab). I tried to checkout and track those branches, and to my big surprise, git did it. But when I do for example git push origin :branch_name, git says that the remote ref does not exist, thus proving that I do not have those branches in my remote. Hence I have a question, are those branches stored in some kind a local cache? And if yes, how to clear it?

like image 316
Carmine Avatar asked Aug 10 '15 13:08

Carmine


People also ask

Where is the git cache?

The Git cache is within a file named index within the . git directory. The command will give you an output showing the file type, version, and the number of entries inside the Git cache file.

How do I remove files from git cache?

Usually, you want to clear your Git cache because you added new entries in your gitignore files and you want them to be taken into account. The easiest way to clear your Git cache is to use the “git rm” command with the “–cached” option. You can choose to remove one file or to remove an entire working directory.

What is git -- cached?

The –cached flag lets you delete a file from a Git repository without deleting it on your file system.


1 Answers

Use git fetch -p to prune your local caches

like image 160
mproffitt Avatar answered Oct 27 '22 20:10

mproffitt