git 简单操作

Kozakemi Lv4

代码管理

image-20230921094200045

创建git仓库

git init

书写代码

书写并保存文件

添加文件

git add .

添加提交

git commit -m "<注释>"

查看当前状态

git status

查看提交历史

git log

查看修改

git diff

恢复提交

git reset --hard <hash>

远程连接

git remote add origin git@github.com:<username>/<depository name>.git
git branch -M main
git push -u origin main

创建分支

git branch <branch-name>

切换分支

git checkout  <branch-name>

删除分支

git branch -d <branch-name>#删除本地分支

git push origin :<branch-name> #删除远程分支

提交分支更改

git push origin <branch-name>
  • 标题: git 简单操作
  • 作者: Kozakemi
  • 创建于 : 2023-09-21 17:08:21
  • 更新于 : 2024-05-17 13:47:59
  • 链接: https://kozakemi.gitlab.io/post/6f2fd8c3.html
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论