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
相关推荐
passerby606138 分钟前
如何自己造一个时间处理库
前端·javascript·github
小弥儿5 小时前
GitHub今日热榜 | 2026-09-04:Agent省 token 成今日主线
学习·开源·github
苏灿烤鱼8 小时前
给 AI Agent 装一个「会进化的大脑」:OpenViking 深度拆解
开源·github·agent
逛逛GitHub8 小时前
清华开源的 Agent 交互学习神器,又登上 GitHub 热榜了。
github
其实防守也摸鱼9 小时前
OpenClaw Windows 踩坑实战指南
运维·服务器·数据库·windows·github·copilot
小马92611 小时前
从单模型到多模型编排:GitHub HydraFusion 如何让编程 Agent 降本 36%-67%
人工智能·github
小弥儿11 小时前
GitHub今日热榜 | 2026-09-08:微软 markitdown 冲进前三
学习·microsoft·开源·github
蜡台12 小时前
超详细 GitHub Actions 自动发布部署教程
github·github page·github action
11路没有终点13 小时前
CI/CD 集成:GitHub Actions
ci/cd·github
右耳朵猫AI14 小时前
Github周刊2026W36 | Archify架构图生成、科研Agent技能库、VoiceStudio本地语音、MiniMind训练6400万参数
github