???♂? 個人主頁: @AI_magician
??主頁地址: 作者簡介:CSDN內(nèi)容合伙人,全棧領(lǐng)域優(yōu)質(zhì)創(chuàng)作者。
?????景愿:旨在于能和更多的熱愛計算機的伙伴一起成長??!?????
???♂?聲明:本人目前大學(xué)就讀于大二,研究興趣方向人工智能&硬件(雖然硬件還沒開始玩,但一直很感興趣!希望大佬帶帶)
該文章收錄專欄
[?— 《深入解析機器學(xué)習:從原理到應(yīng)用的全面指南》 —?]
.gitignore 最佳實踐
https://github.com/github/gitignore
以上有著最全的各中項目所對應(yīng)的.gitignore, 以下則是一個通用的模板
# 忽略操作系統(tǒng)生成的文件
.DS_Store
Thumbs.db
# 忽略編輯器和IDE生成的文件
.vscode/
.idea/
*.sublime-project
*.sublime-workspace
# 忽略編譯生成的文件和文件夾
/build/
/dist/
# 忽略依賴文件夾
/node_modules/
/bower_components/
# 忽略日志文件
*.log
# 忽略臨時文件
*.tmp
# 忽略系統(tǒng)文件
.DS_Store
desktop.ini
# 忽略壓縮文件
*.zip
*.rar
*.gz
# 忽略數(shù)據(jù)庫文件
*.db
*.sqlite
*.sqlite3
# 忽略IDE和編輯器配置文件
*.swp
*.swo
*.swn
*.bak
# 忽略生成的文檔文件
*.html
*.pdf
*.docx
# 忽略備份文件
*.bak
*.backup
# 忽略緩存文件
.cache/
# 忽略日志文件夾
/logs/
# 忽略臨時文件夾
/temp/
/tmp/
# 忽略編譯器和構(gòu)建工具生成的文件
.gradle/
.mvn/
target/
# 忽略Jupyter Notebook生成的文件
.ipynb_checkpoints/
# 忽略環(huán)境配置文件
.env
# 忽略IDE生成的文件
*.iml
# 忽略圖片縮略圖文件夾
/.thumbnails/
# 忽略本地配置文件
*.local
以下則是關(guān)于Python的
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
Git lfs 清空文件
要清空您的Git Large File Storage (LFS)中的所有文件,您可以按照以下步驟進行操作:
-
打開命令行終端或Git Bash。
-
導(dǎo)航到包含您的存儲庫的本地文件夾。
-
運行以下命令以確保您的Git LFS是最新版本:
git lfs update ```
-
運行以下命令以刪除LFS對象和相關(guān)引用:
git lfs prune ``` 這將刪除存儲庫中所有未跟蹤的LFS對象。
-
運行以下命令以從存儲庫中刪除LFS對象:
git lfs ls-files | cut -d ' ' -f 3 | xargs git rm --cached ``` 這將從存儲庫中刪除所有跟蹤的LFS對象。請注意,這只會從存儲庫中刪除跟蹤,而不會刪除實際的LFS對象文件。
如果文件路徑中包含空格或特殊字符,可以嘗試在路徑周圍使用引號或雙引號,例如:
git lfs ls-files | cut -d ' ' -f 3 | xargs -I {} git rm --cached "{}" ``` 這將確保文件路徑被正確地傳遞給`git rm --cached`命令。
如果問題仍然存在,您可以嘗試手動刪除LFS跟蹤的文件。運行以下命令來查看LFS跟蹤的文件列表:
git lfs ls-files
然后,使用
git rm --cached
命令手動逐個刪除文件,例如:git rm --cached path/to/file.ext
請將
path/to/file.ext
替換為LFS跟蹤文件的實際路徑。重復(fù)此步驟直到刪除所有LFS跟蹤的文件。 -
運行以下命令以提交更改:
git commit -m "Remove all LFS objects" ``` 這將創(chuàng)建一個提交,刪除存儲庫中所有LFS對象的跟蹤。
-
運行以下命令以將更改推送到遠程存儲庫:文章來源:http://www.zghlxwxcb.cn/news/detail-828913.html
git push origin <branch-name> ``` 將`<branch-name>`替換為您的分支名稱。
請注意,執(zhí)行上述操作將從存儲庫中移除所有LFS對象的跟蹤,但不會刪除實際的LFS對象文件。如果您希望完全刪除LFS對象文件并釋放存儲空間,請參考Git LFS的文檔或使用適當?shù)拿顏砉芾鞮FS服務(wù)器端的存儲。文章來源地址http://www.zghlxwxcb.cn/news/detail-828913.html
??到這里,如果還有什么疑問??
??歡迎私信博主問題哦,博主會盡自己能力為你解答疑惑的!??
??如果對你有幫助,你的贊是對博主最大的支持!!??
到了這里,關(guān)于【版本管理 | Git 】Git最佳實踐系列(一) —— LFS & .gitignore 最佳實踐,確定不來看看?的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!