切換遠程地址
1、切換遠程倉庫地址:
方式一:修改遠程倉庫地址
【git remote set-url origin URL】 更換遠程倉庫地址,URL為新地址。
git?remote?set-url https://gitee.com/xxss/omj_gateway.git
方式二:先刪除遠程倉庫地址,然后再添加
【git remote rm origin】 刪除現(xiàn)有遠程倉庫
【git remote add origin url】添加新遠程倉庫
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 】查看遠程倉庫的地址
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、查看本地址和遠程版本
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代表遠程分支
git push <遠程主機名> <本地分支名>:<遠程分支名>
例:
git push omj_gateway develop:develop --force
git 版本回退
查看歷史版本
1、查看歷史版本 詳細提交歷史 (q退出)
git logq退出
2、 最近提交版本簡要
git reflog
回退本地版本
1、回退到上一個版本
git reset --hard HEAD^
2、回退某個版本
git reset --hard 530ae79
遠程服務器回退版本
1、先回退本地git版本
2、查看git分支
git branch -v -a
3、推送到遠程git
git push origin HEAD --force