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
相关推荐
孟健42 分钟前
AI Agent 已经开始攻击 GitHub Actions:我整理了 7 条最该先做的加固清单
安全·github·agent
CoovallyAIHub1 小时前
开源一周 6300+ Star!Andrew Ng 发布 Context Hub,专治 AI Agent 调用过时 API
人工智能·架构·github
答案answer1 小时前
我的Three.js3D场景编辑器免费开源啦🎉🎉🎉
前端·github·three.js
lpfasd1232 小时前
2026年第11周GitHub趋势周报:AI智能体爆发,RAG与本地部署成新焦点
人工智能·github
EleganceJiaBao2 小时前
【Git】使用 SSH 进行 Git 操作的完整步骤
git·ssh·github·push·clone
CoderJia程序员甲3 小时前
GitHub 热榜项目 - 日榜(2026-03-16)
人工智能·ai·大模型·github·ai教程
jykqjk3 小时前
Immich 家庭相册服务器部署文档(Ubuntu + Docker + Tailscale + 磁盘扩容 + 自动备份)
github
yzx9910133 小时前
Ollama 完全使用指南:从零开始在本地部署大模型
数据库·mysql·github
潘达斯奈基~3 小时前
养虾-1:数字分身备份至github
ai·github
Sarvartha5 小时前
Python与API
github