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]
相关推荐
uhakadotcom1 小时前
过来人教你写简历的技巧(如何写简历,个人评价 / 个人优势如何写)
面试·架构·github
海天鹰3 小时前
Support for password authentication was removed on August 13, 2021
github
L2ncE6 小时前
【LanTech】DeepWiki 101 —— 以后不用自己写README了
人工智能·程序员·github
我是哈哈hh7 小时前
【Git】初始Git及入门命令行
git·gitee·github·版本控制器
极小狐7 小时前
如何创建并使用极狐GitLab 部署令牌?
运维·git·ssh·gitlab·github
Kusunoki_D8 小时前
Win11 配置 Git 绑定 Github 账号的方法与问题汇总
git·github
小华同学ai8 小时前
牛!达摩院孵化开源项目,让数字人"活"起来:OpenAvatarChat教你轻松搭建自己的数字人
github
码流怪侠11 小时前
开源大语言模型应用 Dify 让你轻松部署 AI 应用
github·aigc
低代码布道师14 小时前
将你的本地项目发布到 GitHub (新手指南)
github
梓羽玩Python15 小时前
月之暗面最新开源模型!Kimi-Audio:革新多模态音频处理,统一音频理解、生成与对话!
人工智能·python·github