Thursday, October 2, 2014

Adding .gitignore file after first repository commit

It happen to me very often to create a git repository and even push it to mu github without first creating a .gitignore file. Specially on Android projects this publishes a lot of unwanted files, like binary and temporary files. For this I found a post on stackoverflow for just that.

From all the post I read this is the one that worked for me (at least now)
http://stackoverflow.com/questions/7927230/remove-directory-from-remote-repository-after-adding-them-to-gitignore

I did this, however in the post is more information about it, please go to the stackoverflow link and if it work for you go ahead a plus it.
git rm --cached `git ls-files -i --exclude-from=.gitignore` 
git commit -m 'Removed all files that are in the .gitignore' 
git push origin master

If you have a better way to do this please leave a comment.

1 comment:

  1. Gambling in Qatar - Casino & Sports Book
    All the latest casino air jordan 18 retro racer blue super games jordan 18 white royal blue for sale and sports air jordan 18 retro yellow from us betting odds. air jordan 18 retro toro mens sneakers good site Sports betting, gambling air jordan 18 retro yellow good site on football, eSports, poker and more. Visit our website.

    ReplyDelete