GitHub常用命令

GitHub常用命令

远程仓库相关命令

拉取项目到本地

shell 复制代码
git clone [url]

拉取远程仓库

shell 复制代码
git pull [remoteName] [localBranchName]

推送远程仓库

shell 复制代码
git push [remoteName] [localBranchName]

分支操作相关命令

查看所有本地分支

shell 复制代码
git branch

查看所有远程分支

shell 复制代码
git branch -r

查看所有本地分支和远程分支

shell 复制代码
git branch -a

切换分支

shell 复制代码
git checkout [分支名称]

创建本地分支

shell 复制代码
//注意:新分支创建后不会自动切换为当前分支
git branch name

创建远程分支(本地分支push到远程)

shell 复制代码
git push origin [分支名称]

创建新分支并切换到新分支

shell 复制代码
git checkout -b  [分支名称]

合并指定分支到当前分支

shell 复制代码
git merge [分支名称]

删除分支

shell 复制代码
git branch -d [分支名称]

代码提交相关命令

提交至暂存区

shell 复制代码
git stash save [message]

恢复暂存区代码

shell 复制代码
git stash apply

提交暂存区到仓库区

shell 复制代码
git commit -m [message]

查看信息

显示有变更的文件

shell 复制代码
git status

显示当前分支的版本历史

shell 复制代码
git log

显示commit历史

shell 复制代码
git log --stat

版本(tag)操作相关命令

创建版本

shell 复制代码
git tag [name]

查看所有版本

shell 复制代码
git tag

查看tag信息

shell 复制代码
git show [tag]

删除本地版本

shell 复制代码
git tag -d [name]
相关推荐
逛逛GitHub11 小时前
刚刚!Open AI 宣布开源?
github
不是伍壹14 小时前
【R语言】GitHub Copilot安装-待解决
github·copilot
虾饺爱下棋14 小时前
pycharm上传github问题:rejected
人工智能·深度学习·github
鸠摩智首席音效师14 小时前
如何在 GitHub 中创建一个空目录 ?
github
Mr.W.T18 小时前
Spring Boot “约定大于配置”
github
不cong明的亚子21 小时前
github用户名密码登陆失效了
git·github
QC七哥1 天前
git开发流程以及github社区企业版
git·github
邂逅you1 天前
GitHub基本操作及Git简单命令
git·github
misty youth2 天前
github与git bash绑定问题
git·github·bash
油泼辣子多加2 天前
2025年02月14日Github流行趋势
github