Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unversion on Git

I'm designing and building an iOS app, it's under version control with a local git repository. So far I have had everything under version control, including the big folders such as 'Design' which is full of my Photoshop assets and such. I have now added a remote location to the repo and obviously would not want to commit the Design folder to the remote.

I made a .gitignore file with the following:

# File Extensions #
###################
*.psd

# Folders #
###########
/Design/*

which should exclude that folder and any Photoshop documents right?

How do I unversion the existing design folder (git rm actually deletes the files!)? Also, when I unversion it, will it automatically shrink the enormous .git folder?

Thanks alot.

like image 813
Adam Waite Avatar asked Dec 16 '22 16:12

Adam Waite


1 Answers

Using git you can use git rm --cached design/, that will keep the files.

To remove it from the entire history you could try something like :

$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch design/' \
  --prune-empty --tag-name-filter cat -- --all

$ rm -rf .git/refs/original/

$ git reflog expire --expire=now --all

$ git gc --prune=now

$ git gc --aggressive --prune=now

ref : https://help.github.com/articles/remove-sensitive-data

like image 121
OneOfOne Avatar answered Dec 18 '22 07:12

OneOfOne