How to clean up local Git repository

Web Development How to clean up local Git repository

A cluttered Git repository can hinder your workflow, slow down your development process, and make collaboration difficult. Over time, unused branches, stale files, and unnecessary commits can accumulate, making your repository bloated and inefficient.

Delete old branches

git remote prune origin

Clear cache

git rm -r --cached .

Restart Git

Delete .git folder, after that

git remote add origin https://github.com/user-name/website-repository
// OR
git remote add origin https://github.com/user-name/website-repository.git

git pull origin