git 切换远程地址分支 推送到指定地址分支 版本回退

切换远程地址

1、切换远程仓库地址:

方式一:修改远程仓库地址

【git remote set-url origin URL】 更换远程仓库地址,URL为新地址。

bash 复制代码
git remote set-url https://gitee.com/xxss/omj_gateway.git

方式二:先删除远程仓库地址,然后再添加

【git remote rm origin】 删除现有远程仓库

【git remote add origin url】添加新远程仓库

bash 复制代码
git remote rm origin https://github.com/****/omj_gateway.git
git remote add origin  https://gitee.com/xxss/omj_gateway.gi

2、【git remote -v 】查看远程仓库的地址

bash 复制代码
omj_gateway https://github.com/****/omj_gateway.git (fetch)
omj_gateway https://github.com/xxs/omj_gateway.git (push)
origin https://gitee.com/xxss/omj_gateway.git (fetch)
origin https://gitee.com/xxs/omj_gateway.git (push)

推送到指定地址分支

1、查看本地址和远程版本

bash 复制代码
git branch -a

  debug
* develop
  main
  remotes/omj_gateway/develop
  remotes/omj_gateway/main
  remotes/origin/HEAD -> origin/main
  remotes/origin/develop
  remotes/origin/main

remotes代表远程分支

2、推送到远程分支

git push <远程主机名> <本地分支名>:<远程分支名>

例:

bash 复制代码
git push  omj_gateway develop:develop --force

git 版本回退

查看历史版本

1、查看历史版本 详细提交历史 (q退出

bash 复制代码
git log

q退出

2、 最近提交版本简要

bash 复制代码
git reflog

回退本地版本

1、回退到上一个版本

bash 复制代码
git reset --hard  HEAD^

2、回退某个版本

bash 复制代码
git reset --hard 530ae79

远程服务器回退版本

1、先回退本地git版本

2、查看git分支

bash 复制代码
git branch -v -a

3、推送到远程git

bash 复制代码
git push origin HEAD --force

谢谢阅读!请大家帮忙点赞、转发、在看,为小编加鸡腿,请点亮关注,关注我不迷路,更多软硬件开发知识推送给您。

往期精彩

【经验】 cp -rf 命令中参数 -f 失效 ( 依旧要手动确认 )解决愿意付出

【openwrt】MT7628/7688 openwrt下启用串口2 UART2入坑指南

「Shell脚本」Shell脚本程序开发------变量(二)

智能离线语音识别全屋智能语音控制方案

介绍一款高性比的Zigbee无线模块

推荐一款vsCode 可能智能生成代码 代码补全 代码解释 代码纠错 AI插件 iFlyCode

「Shell」Linux shell 脚本编程------认识Shell(一)

【Linux应用开发】fork()函数详解

【openwrt应用开发】openwrt交叉编译自己的应用程序入门--开发类似minicom串口终端

【IC推荐】锦锐单片机CA51F152S4A/B PWM+ADC+触控型8051MCU

openwrt怎么升级固件?使用命令sysupgrade实现openwrt升级固件

相关推荐
TDengine (老段)6 分钟前
TDengine 支持的平台汇总
大数据·数据库·物联网·时序数据库·iot·tdengine·涛思数据
火龙谷8 分钟前
【hadoop】相关集群开启命令
大数据·hadoop·分布式
Elasticsearch1 小时前
ES8 向量功能窥探系列(二):向量数据的存储与优化
elasticsearch
livemetee2 小时前
一个完整的日志收集方案:Elasticsearch + Logstash + Kibana+Filebeat (二)
大数据·elk·搜索引擎
安审若无2 小时前
Elasticsearch中的监控(Monitoring)功能介绍
elasticsearch·搜索引擎·全文检索
leo_hush3 小时前
elasticsearch基本操作笔记
elasticsearch
TDengine (老段)3 小时前
TDengine 开发指南——无模式写入
大数据·数据库·物联网·时序数据库·iot·tdengine·涛思数据
TDengine (老段)3 小时前
TDengine 在电力行业如何使用 AI ?
大数据·数据库·人工智能·时序数据库·tdengine·涛思数据
盛寒4 小时前
自然语言处理 目录篇
大数据·自然语言处理
武子康5 小时前
大数据-276 Spark MLib - 基础介绍 机器学习算法 Bagging和Boosting区别 GBDT梯度提升树
大数据·人工智能·算法·机器学习·语言模型·spark-ml·boosting