git的常规操作
2021-03-29 本文已影响0人
sws1314
git的常规操作
.gitignore不起作用
git rm -r --cached .
git add .
git commit -m "update .gitignore file"
git push
添加远端
git remote add origin 远端地址
git push -u origin master
或者
git push origin master
撤销commit
git reset --soft HEAD~1
命令行解释
如果进行两次的commit,想要都撤回,可以使用HEAD~2
上传的文件超过100M
# 从缓存中删除(在git的顶级目录执行以下代码)
git filter-branch -f --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch 要删除的文件路径' --tag-name-filter cat -- --all
# 再次进行push操作
git push origin master