Skip to content

Instantly share code, notes, and snippets.

@Naf3tS
Naf3tS / git.md
Created April 13, 2024 16:31 — forked from refactorsaurusrex/git.md
How to retroactively apply gitignore to a repo
  1. Add or update a .gitignore file
  2. Rebase your repo such that the .gitignore from step one is positioned in history prior to the naughty file(s) being commited.
  3. Run this command, where <commit> is the hash for the commit respresented by step 1: git rebase -ix 'git rm -r --cache . && git add . && git commit --amend --no-edit' <commit>
  4. Resolve conflicts as necessary.

Note that if there are only a few file types or directories or individual files, filter-branch is a simpler route to take. These steps are only necessary for large numbers of files / file types. Also note that there may be better ways still of doing this. :-)

If .DS_Store was never added to your git repository, simply add it to your .gitignore file.

If you don't have one, create a file called

.gitignore

In your the root directory of your app and simply write

@Naf3tS
Naf3tS / list.md
Created January 16, 2021 19:53 — forked from ih2502mk/list.md
Quantopian Lectures Saved