catalog
Commands
.gitignore
文件
在( .git
文件夹)同级目录, 创建.gitignore
文件, 输入:
**/__pycache__ // 所有位置的 这个文件夹
DATABASE/* // 当前位置的 这个文件夹
*.exe // 当前位置的 这个文件
这样, git 就不管这些 (文件夹/文件)
通过git status
来看, 如果这个文件 貌似没有起作用
先把 (暂存区) 给清空后, 再git add .
git ls-files
所有暂存区里的文件
git restore a.txt
- 如果(暂存区)里, 没有这个文件, 是会报错的:
error: pathspec 'a.txt' did not match any file(s) known to git
- 如果(暂存区)里有这个文件, 则: 将本地的a.txt内容, 修改为, 暂存区里a.txt内容
git restore --staged a.txt
将 (暂存区)里的a.txt, 修改为 (版本库)的a.txt内容
git restore --staged *
, (暂存区) 和 (版本库) 完全一样
git rm --cached -f a.txt
将暂存区里的 a.txt
给删除掉
git rm --cached -f -r *
, 此时, 暂存区为空
git add .
(工作区) 和 (暂存区) 完全一样
common commands
git ls-files
暂存区里, 有哪些文件git rm --cached a.txt
从暂存区中, 删除文件
用于: 在执行完git add .
后, 把一些.obj .exe
给撤销掉git restore a.txt
将工作区的该文件内容, 修改为 暂存区的该文件内容git restore --staged a.txt
将暂存区的该文件内容, 修改为 版本库的该文件内容
-----------------------------------------
Basic
基本流程
mkdir project
vim readme.txt
git init
git config --global user.name Supimo
git config --global user.email 2801797568@qq.com
git add .
git status
git rm --cached *