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
相关推荐
最强小杰7 小时前
Claude Opus 4.8 调用一直报 529 怎么办?同样请求换旧模型却正常——附 429/529 双桶退避代码
ai·github
来自于狂人10 小时前
GitHub 开源趋势日报 | 2026年10月7日用 AI Agent 逆向工程一切
人工智能·开源·github
逛逛GitHub11 小时前
盘点 20 个 9 月份 GitHub 上顶顶顶的开源项目。
github
miofly12 小时前
Google 发布 EmbeddingGemma 2:7.4 亿参数的多模态嵌入模型
开源·github
wflynn13 小时前
GitHub 今日推荐|lightcraft:纯 Rust 重写的 RAW 照片开发工具
rust·开源·github·lightroom·art·photography
wflynn14 小时前
GitHub 日榜趋势速报 | 2026-10-07
开源·github
孟陬14 小时前
#教程 dw, dm, dy, d18m 是何意?万物可 Badge | 定制漂亮精致小徽章,打造眼前一亮 README
npm·github
爱写代码的倒霉蛋14 小时前
新手如何借助agent改造github项目(保姆级教程)
github·新手友好·改造项目
u13013014 小时前
GitHub 热榜项目:日榜(2026-10-07)
驱动开发·github
高频因子挖掘机14 小时前
量化选股到底要不要每天拉全市场股票?从全市场扫描到候选池的行情数据设计
后端·github·api