1、本地项目提交到github
1.1、创建一个仓库,例如Test
1.2、克隆Test到本地
1 | git clone test.git |
1.3、将本地项目的所有文件复制到Test里面
1.4、执行git add 添加需要上传的文件
1 | git add . #相当于选中所有项目文件 |
1.5、提交到本地git管理
1 | git commit -m "first commit" |
1.6、推送到github
1 | git push -u origin master/main |
2、删除提交记录
2.1、查看提交历史
1 | git log --oneline |
2.2、重置到指定提交
1 | git reset --soft HEAD~2 #保留暂存区 |
2.3、强制推送到远程仓库
1 | git push --force |
3、更新提交信息
1 | git commit --amend -m "新的提交信息" |