Git操作

一、GIT下载代码

bash 复制代码
git clone xxx.git

二、Git上传代码

  1. 修改代码后,查看所有的修改项目。
bash 复制代码
git status
  1. 将所有修改的项目添加到本地
bash 复制代码
git add .
  1. 添加代码提交备注信息
bash 复制代码
git commnit -m "xxxxxxxx"
  1. 提交代码到远程服务器
c 复制代码
git push -u origin master

三、打TAG

Git打标签(tag)是为了标记特定的开发点,比如版本发布。以下是如何使用git命令打标签的步骤:

  1. 创建轻量级标签:
bash 复制代码
git tag <tagname>
  1. 创建带有注释的标签:
bash 复制代码
git tag -a <tagname> -m "<message>"
  1. 列出所有标签:
bash 复制代码
git tag
  1. 推送特定标签到远程仓库:
bash 复制代码
git push origin <tagname>
  1. 推送所有本地标签到远程仓库:
bash 复制代码
git push --tags
  1. 删除本地标签:
bash 复制代码
git tag -d <tagname>
  1. 删除远程标签:

首先删除本地标签,然后:

bash 复制代码
git push --delete origin <tagname>

检出标签:

bash 复制代码
git checkout <tagname>

例如,创建一个带注释的v1.0.0标签:

bash 复制代码
git tag -a v1.0.0 -m "Release version 1.0.0"

然后将其推送到远程仓库:

bash 复制代码
git push origin v1.0.0
相关推荐
小黑要努力12 小时前
智能音箱遇到的问题(一)
linux·运维·git
RePeaT12 小时前
【git】指令场景实战:单分支与多分支协作流程
git
前端Hardy14 小时前
杀疯了!Git 2.54 正式发布,3个封神新特性,效率直接翻倍!
git
Eloudy15 小时前
迁移带有 git lfs 功能的 github 仓库
git·github
xlq2232216 小时前
1.git
git
运维全栈笔记18 小时前
零基础掌握Jenkins CI/CD:Java项目自动构建与部署全流程指南
git·servlet·ci/cd·gitee·自动化·jenkins·devops
菜萝卜子19 小时前
【Git】GitLab 18.9 全局服务器钩子(Server Hooks)官方规范与落地实践
服务器·git·gitlab
用户114818678948420 小时前
Git Stash 丢失后的完整找回指南
前端·git
Ting.~20 小时前
GIT详解
java·笔记·git
克拉拉KLARA21 小时前
vscode禁用在git提交中插入ai coauthor copilot
git·vscode·copilot