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
相关推荐
njsgcs20 分钟前
仓库子文件夹设置不公开 git submodule add
git
草莓熊Lotso35 分钟前
Python 库使用全攻略:从标准库到第三方库(附实战案例)
运维·服务器·汇编·人工智能·经验分享·git·python
CNRio40 分钟前
Day 51:Git的高级技巧:使用Git的reflog恢复丢失的提交
大数据·git·elasticsearch
ZeroNews内网穿透1 小时前
轻量级自托管Git服务:Gitea私有化部署与公网访问
服务器·网络·数据库·git·gitea
rannn_11115 小时前
【Java项目】中北大学Java大作业|电商平台
java·git·后端·课程设计·中北大学
wordbaby18 小时前
公私分明:为什么你不应该共用 SSH Key(附多账号最佳实践指南)
前端·git·ssh
Albert Edison20 小时前
【Git】分支管理
大数据·git·elasticsearch
Forest_HAHA20 小时前
<4>,Git多人协作
git
CNRio1 天前
Day 43:Git的高级技巧:使用Git的rebase简化提交历史
大数据·git·elasticsearch
少云清1 天前
【接口测试】2_持续集成 _Git与Gitee
git·ci/cd·gitee