Git常用命令

33 阅读1分钟

#Git常用命令 查看文件状态: git status
将文件加入暂存区: git add
将暂存区的文件提交到版本库: git commit
查看详细的提交日志: git log
显示当前分支的最近几次提交,更加简洁明了: git reflog
将暂存区文件取消暂存或切换到指定版本: git reset

#远程仓库命令 从远程仓库克隆: git clone <url>
添加关联的远程仓库: git remode add <shortname> <url>
移除关联的远程仓库: git remode remove <shortname>
往远程仓库推送: git push <shortname> <branch>
查看关联的远程仓库: git remote [-v]
从远程仓库拉取: git pull <shortname> <branch>

#分支命令 查看分支: git branch [-a]
创建新的分支: git branch <branchname>
切换分支: git checkout <branchname>
将指定分支推送到远程仓库: git merge <branchname>