网站首页 > 精选文章 正文

初始化一个新的 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标签功能:为代码打上标签的重要性
猜你喜欢
- 2024-12-24 Git 使用技巧:从新手到大师
- 2024-12-24 git 基础用法
- 2024-12-24 百分之九十八的人不知道git操作如何查看所有版本
- 2024-12-24 Linux 版本控制:用 Git 管理代码的艺术
- 2024-12-24 Git团队多人协作开发分支流程管理方案
- 2024-12-24 git commitid相关知识一网打尽
- 2024-12-24 git的基本操作
- 2024-12-24 用 Golang封装你的API
- 2024-12-24 够骚!用 Python 还能玩 Git
- 2024-12-24 Git标签功能:为代码打上标签的重要性
- 最近发表
- 标签列表
-
- 向日葵无法连接服务器 (32)
- git.exe (33)
- vscode更新 (34)
- dev c (33)
- git ignore命令 (32)
- gitlab提交代码步骤 (37)
- java update (36)
- vue debug (34)
- vue blur (32)
- vscode导入vue项目 (33)
- vue chart (32)
- vue cms (32)
- 大雅数据库 (34)
- 技术迭代 (37)
- 同一局域网 (33)
- github拒绝连接 (33)
- vscode php插件 (32)
- vue注释快捷键 (32)
- linux ssr (33)
- 微端服务器 (35)
- 导航猫 (32)
- 获取当前时间年月日 (33)
- stp软件 (33)
- http下载文件 (33)
- linux bt下载 (33)