JR语言作业GitHub仓库中生成文件的.gitignore配置问询
Hey there! Since you're using m2jr to convert .m monitor files into .jr files for your JR programming assignments, ignoring those auto-generated files in Git is straightforward. Here's how to set it up properly:
Basic Approach (All Generated .jr Files)
If all your .jr files are created by m2jr (no manually written .jr files you want to keep), just add this line to your .gitignore file:
*.jr
This tells Git to ignore every file ending with .jr, which covers all converted monitor files like whateverMonitor.jr that come from whateverMonitor.m.
If You Have Manual .jr Files
If you do have some .jr files you wrote yourself and want to track, use a combination of ignore and "un-ignore" rules:
# Ignore all .jr files first *.jr # Un-ignore specific manual .jr files (add as many as you need) !my-custom-code.jr !another-manual-file.jr
The ! prefix tells Git to not ignore the file that follows, so your hand-written JR files will still be tracked.
Final Steps to Make It Stick
- Save your
.gitignorefile. - If you've already accidentally committed any generated
.jrfiles, run this command to remove them from Git's tracking (without deleting the actual file from your computer):git rm --cached *.jr - Commit the
.gitignorechange to your repository so the rule applies to everyone working on the project.
Just double-check with git status afterward—your generated .jr files should no longer show up as untracked!
内容的提问来源于stack exchange,提问作者Maxime4000

