切換遠(yuǎn)程地址
1、切換遠(yuǎn)程倉庫地址:
	方式一:修改遠(yuǎn)程倉庫地址
	【git remote set-url origin URL】 更換遠(yuǎn)程倉庫地址,URL為新地址。
gitremoteset-url https://gitee.com/xxss/omj_gateway.git
方式二:先刪除遠(yuǎn)程倉庫地址,然后再添加
	【git remote rm origin】 刪除現(xiàn)有遠(yuǎn)程倉庫
	【git remote add origin url】添加新遠(yuǎn)程倉庫
gitremotermoriginhttps://github.com/****/omj_gateway.git git remote add origin https://gitee.com/xxss/omj_gateway.gi
2、【git remote -v 】查看遠(yuǎn)程倉庫的地址
omj_gatewayhttps://github.com/****/omj_gateway.git(fetch) omj_gatewayhttps://github.com/xxs/omj_gateway.git(push) originhttps://gitee.com/xxss/omj_gateway.git(fetch) origin https://gitee.com/xxs/omj_gateway.git (push)
	推送到指定地址分支
	1、查看本地址和遠(yuǎn)程版本
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代表遠(yuǎn)程分支
	git push <遠(yuǎn)程主機(jī)名> <本地分支名>:<遠(yuǎn)程分支名>
	例:
git push omj_gateway develop:develop --force
	git 版本回退
	查看歷史版本
1、查看歷史版本 詳細(xì)提交歷史 (q退出)
git log
q退出
2、 最近提交版本簡要
git reflog
	
	回退本地版本
1、回退到上一個(gè)版本
git reset --hard HEAD^
	
	2、回退某個(gè)版本
git reset --hard 530ae79
	
	遠(yuǎn)程服務(wù)器回退版本
	1、先回退本地git版本
	2、查看git分支
git branch -v -a
3、推送到遠(yuǎn)程git
git push origin HEAD --force
審核編輯:湯梓紅
- 
                                URL
                                +關(guān)注
關(guān)注
0文章
141瀏覽量
16081 - 
                                倉庫
                                +關(guān)注
關(guān)注
0文章
21瀏覽量
13723 - 
                                Git
                                +關(guān)注
關(guān)注
0文章
205瀏覽量
16690 
原文標(biāo)題:git 切換遠(yuǎn)程地址分支 推送到指定地址分支 版本回退
文章出處:【微信號(hào):嵌入式加油站,微信公眾號(hào):嵌入式加油站】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。
發(fā)布評論請先 登錄
關(guān)于git的遠(yuǎn)程分支的詳細(xì)介紹
    
Git命令之本地分支與遠(yuǎn)程分支關(guān)聯(lián)和解除
    
飛凌ElfBoard ELF 1板卡-ubuntu18.04 git安裝及基本使用
git shell 常用命令
Git 常用命令大全
git簡單使用(一)
Git分支,為何以及如何使用分支
Git / GitHub 是什么?有什么用?
Git的分支管理
    
git拉取遠(yuǎn)程分支到本地的兩種方法
git rebase與相關(guān)git merge命令比較
    
git rebase和git merge的區(qū)別
    
          
        
        
git切換遠(yuǎn)程地址分支方式
                
 
    
    
           
            
            
                
            
評論