Initial commit
This commit is contained in:
17
gigignore_cleanup.py
Normal file
17
gigignore_cleanup.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# open gitignore file, remove comments, blank lines and duplicate entries
|
||||
def clean_gitignore(file_path: str):
|
||||
with open(file_path, "r") as file:
|
||||
lines = file.readlines()
|
||||
|
||||
cleaned_lines = set()
|
||||
for line in lines:
|
||||
stripped_line = line.strip()
|
||||
if stripped_line and not stripped_line.startswith("#"):
|
||||
cleaned_lines.add(stripped_line)
|
||||
|
||||
with open(file_path, "w") as file:
|
||||
for line in sorted(cleaned_lines):
|
||||
file.write(f"{line}\n")
|
||||
|
||||
|
||||
clean_gitignore(".gitignore")
|
||||
Reference in New Issue
Block a user