# Create a temporary directory for testing
tmp_dir <- tempdir()
# Write the .gitignore file
write_ignore(path = tmp_dir)
# Confirm the file was created (optional, for user confirmation)
file.exists(file.path(tmp_dir, ".gitignore"))
# Clean up: Remove the created file
unlink(file.path(tmp_dir, ".gitignore"))
Run the code above in your browser using DataLab