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
相关推荐
fu的博客2 小时前
Git从删库到跑路
git·gitee·github
要加油哦~2 小时前
git 报错 | husky - pre-commit hook exited with code 1 解决
git
知识即是力量ol2 小时前
Git 实战指南:从分支管理到冲突解决
git·github·源代码管理
weixin_4624462315 小时前
Git 本地忽略 application-dev.yml 的最佳实践:不提交 .gitignore,不影响团队协作!
git
无限进步_1 天前
面试题 02.02. 返回倒数第 k 个节点 - 题解与详细分析
c语言·开发语言·数据结构·git·链表·github·visual studio
2401_859049081 天前
git submodule update --init --recursive无法拉取解决
前端·chrome·git
是店小二呀1 天前
Git 深度学习笔记:从初始化到核心操作机制解析
笔记·git
xlq223221 天前
11.git_gbd
git
CCC:CarCrazeCurator1 天前
IDE 与编程语言区分介绍
git·github
Q741_1471 天前
Git 基础操作速查手册 场景模拟
git·学习·版本控制·总结