网站首页 > 技术文章 正文
初始化一个新的 Git 仓库:
git init
添加文件到暂存区:
git add <file name>
提交更改到本地仓库:
git commit -m "Commit message"
将本地仓库的更改推送到远程仓库:
git push origin <branch name>
从远程仓库获取最新的更新:
git pull origin <branch name>
切换分支:
git checkout <branch name>
创建新的分支:
git branch <branch name>
删除分支:
git branch -d <branch name>
查看分支列表:
git branch
合并分支:
git merge <branch name>
查看提交历史:
git log
查看当前仓库状态:
git status
添加远程仓库:
git remote add origin <remote repository URL>
从远程仓库克隆到本地:
git clone <remote repository URL>
查看远程仓库列表:
git remote -v
撤销暂存的文件:
git reset HEAD <file name>
恢复文件到最近一次提交的状态:
git checkout -- <file name>
创建标签:
git tag <tag name>
列出标签:
git tag
重置到指定的提交:
git reset <commit hash>
这些示例覆盖了 Git 的一些常用功能和选项,可以帮助你开始使用 Git。请注意,Git 的功能非常丰富,还有很多其他命令和选项可供探索和学习。建议你参考 Git 的官方文档以获取更详细的信息和更多的功能示例。
- 上一篇: 快速掌握 Git:程序员必会的版本控制技巧
- 下一篇: Git 版本控制:从入门到精通的必备指南
猜你喜欢
- 2025-01-31 Git教程 - Git 命令与操作(git基本操作命令)
- 2025-01-31 因难用饱受诟病,Git十年忠实用户:问题不在工具,在使用者
- 2025-01-31 20个 Git 命令玩转版本控制(git版本控制管理 pdf)
- 2025-01-31 同步GIT仓库的操作 -- fetch命令(git fork 同步)
- 2025-01-31 学习 Git,看这一篇就够了(git要学多久)
- 2025-01-31 idea如何更改git用户(idea修改gitlab账户)
- 2025-01-31 Git常用操作(持续更新)(git常用操作详解)
- 2025-01-31 最全的GitOps工具选型,30+款工具随你挑
- 2025-01-31 赶紧收藏这些Git命令,有了这些你就可以遨游github了!
- 2025-01-31 小白也能学会的 Git 原理—图解 git commit 命令
- 最近发表
- 标签列表
-
- cmd/c (64)
- c++中::是什么意思 (83)
- 标签用于 (65)
- 主键只能有一个吗 (66)
- c#console.writeline不显示 (75)
- js判断是否空对象 (63)
- pythoncase语句 (81)
- es6includes (73)
- sqlset (64)
- phprequire_once (61)
- localstorage.removeitem (74)
- vector线程安全吗 (70)
- & (66)
- java (73)
- org.redisson (64)
- cannotinstantiatethetype (62)
- js数组插入 (83)
- gormwherein (64)
- linux删除一个文件夹 (65)
- mac安装java (72)
- outofmemoryerror是什么意思 (64)
- flask文件上传 (63)
- eacces (67)
- 查看mysql是否启动 (70)
- 无效的列索引 (74)