Git基本使用

找一个文件夹

git init

代码仓库,里面的内容千万不要动

新建一个文件,如test.txt

复制代码
git add test.txt
//git add .  //all

暂存区

复制代码
git commit -m "新增了一个点赞"

最常用的流程:

修改一个文件

git add

git commit

复制代码
git log  //查看节点
git log --stat //查看修改了什么文件

commit id

复制代码
git diff id

git 管理工具如pycharm

回溯

复制代码
git reset --hard [commit id]
git checkout [commit id]

分支

复制代码
git branch

查看哪些分支

复制代码
git checkout -b develop //新建分支
git branch

建立完毕 需要合并 develop->master

复制代码
git add .
git commit -m "新增了关注和转发功能"
git checkout master
git merge develop
相关推荐
@呱呱爱学习15 小时前
2026年09月28日 | 呱呱AI日报】GitHub 发布 Copilot WSL 教程,介绍在 Ubuntu 中运行编程 Agent
人工智能·github·copilot
阿里嘎多学长18 小时前
2026-09-28 GitHub 热点项目精选
开发语言·程序员·github·代码托管
程序员清风18 小时前
vLLM 实战:用 OpenAI 兼容接口部署本地大模型推理服务
开源·github·vllm
七牛云行业应用21 小时前
Jev 报 401 / api_key_required 怎么解决:TypeSafe AI 官方错误码表与排查步骤
算法·github
誰能久伴不乏1 天前
保姆级 GitHub 协作教程
github
miofly1 天前
Claude 自主发现类 CRISPR 结构的新型逆转录酶系统:Anthropic 生命科学实验室的早期成果
开源·github
HelloGitHub1 天前
《HelloGitHub》第 126 期
开源·github
miofly1 天前
GitHub 日榜趋势速报 | 2026-09-28
开源·github
miofly1 天前
GitHub 日榜趋势速报 | 2026-09-27
开源·github
怕浪猫1 天前
顶级模型一句话,AI 写出了能玩的 QQ飞车
前端·面试·github