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
相关推荐
李菠菜38 分钟前
解决Windows系统下Git克隆时报错“unable to checkout working tree”的方法详解
windows·git
island13141 小时前
【git#4】分支管理 -- 知识补充
大数据·git·elasticsearch
船长@Quant2 小时前
协作开发攻略:Git全面使用指南 — 引言
git·版本控制·源代码管理·协作开发
极小狐3 小时前
极狐GitLab 项目功能和权限解读
运维·git·安全·gitlab·极狐gitlab
极小狐3 小时前
极狐GitLab 如何 cherry-pick 变更?
人工智能·git·机器学习·gitlab
前端太佬6 小时前
从拧螺丝到造火箭:Git高阶玩家生存报告
前端·git·github
前端太佬6 小时前
从青铜到塑料:Git逃难指南(附救命指令大全)
前端·git·github
Athel6 小时前
git 建立本地仓库并且推送到github上
git
李菠菜6 小时前
Windows Terminal 集成 Git Bash 的简洁配置指南
windows·git
高级IT技术专家secops9987 小时前
在统信UOS/麒麟Kylin OS操作系统中配置APT和GIT代理
运维·服务器·git·系统安全·kylin