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升级固件

相关推荐
Lill_bin8 小时前
深入理解ElasticSearch集群:架构、高可用性与数据一致性
大数据·分布式·elasticsearch·搜索引擎·zookeeper·架构·全文检索
涛思数据(TDengine)8 小时前
TDengine 与 SCADA 强强联合:提升工业数据管理的效率与精准
大数据·时序数据库·tdengine
isNotNullX9 小时前
如何用SQL Server和Oracle进行数据同步?
大数据·数据库·sql·oracle
RwTo10 小时前
Elasticsearch 聚合搜索
大数据·elasticsearch·搜索引擎·全文检索
isNotNullX10 小时前
HBase在大数据实时处理中的角色
大数据·数据库·hbase
白总Server10 小时前
MySQL在大数据场景应用
大数据·开发语言·数据库·后端·mysql·golang·php
求学小火龙11 小时前
ElasticSearch介绍+使用
java·大数据·elasticsearch
檀越剑指大厂11 小时前
【Elasticsearch系列六】系统命令API
大数据·elasticsearch·搜索引擎
数据运营新视界11 小时前
你知道企业架构中核心的4大架构联系和不同吗?
大数据·架构
h1771134720511 小时前
基于区块链的相亲交易系统源码解析
大数据·人工智能·安全·系统架构·交友