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
相关推荐
神一样的老师1 小时前
【兆易创新GD32VW553开发板试用】 BSP 从 GitHub 下载与编译指南
单片机·github·rt-thread
DevilSeagull2 小时前
MySQL(1) 安装与配置
java·数据库·git·mysql·http·开源·github
kefon2 小时前
从零搭一个 AI Agent:我选了最省钱的方案
开源·github·agent
FreeBuf_4 小时前
GitHub评论可触发Claude Code、Gemini CLI和GitHub Copilot的提示注入漏洞
github·copilot
fzil0014 小时前
GitHub 项目自动 Star + Issue 监控
人工智能·github·issue
Daydream.V4 小时前
github基础入门及git安装配置
git·github·git学习·github学习
万琛4 小时前
【 GitHub GraphQL 】查询优化
github·graphql
Java_2017_csdn5 小时前
‌IntelliJ IDEA 2026.1 中 Git、GitHub、GitLab 功能对比与实操指南
git·github·intellij-idea
本地化文档5 小时前
rustup-book-l10n
rust·github·gitcode
wohehe19 小时前
Android项目工程化-Github Actions
linux·github