Git命令检索(自存)

Git

简易的命令行入门教程:

Git 全局设置:

git config --global user.name "罗艺绮"
git config --global user.email "1577215020@qq.com"

创建 git 仓库:

mkdir the-first-warehouse
cd the-first-warehouse
git init(需要)
touch README.md
git add README.md
git commit -m "first commit"(需要)
git remote add origin https://gitee.com/luo-yiqi76/the-first-warehouse.git(需要)
git push -u origin "main"(需要)

已有仓库?

cd existing_git_repo
git remote add origin https://gitee.com/luo-yiqi76/the-first-warehouse.git
git push -u origin "main"

第二次以后:

git add .
git commit -m "first commit"
git push

Github版

git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/Nightingale76/example.git
git push -u origin "main"

克隆

git clone [https://gitee.com/luo-yiqi76/the-first-warehouse.git](https://gitee.com/luo-yiqi76/the-first-warehouse.git)

查看当前哪些文件改了。

git status

只是想看看文件改了什么:

git diff 文件名

如果想看提交历史(存档列表)

git log --oneline

想恢复到最近一次提交的状态:

git restore 文件名
posted @ 2026-05-29 15:43  清露宵偃  阅读(7)  评论(0)    收藏  举报