Git 是一个开源的分布式版本控制系统,用于跟踪和管理代码变更。以下是一些常用的 Git 命令及其简要说明。
基本命令
git clone <url>
: 克隆一个仓库。git init
: 初始化一个新的仓库。git add <file>
: 添加文件到暂存区。git commit -m "<message>"
: 提交更改。git push
: 推送更改到远程仓库。
分支管理
git branch
: 查看分支。git checkout <branch>
: 切换到指定分支。git branch -b <branch>
: 创建一个新分支。git merge <branch>
: 合并分支。
日志与状态
git log
: 显示提交日志。git status
: 显示当前仓库状态。
其他命令
git pull
: 从远程仓库获取更改。git push
: 推送更改到远程仓库。git remote
: 管理远程仓库。
Git 图标
更多信息,请参阅本站 Git 教程。