Open Joyeuxman opened 5 years ago
查看本地现在的远程仓库地址
git remote -v //output origin http://xxx.xxx.old.git
删除本地现在的远程仓库地址
git remote rm origin
验证本地现在的远程仓库地址是否删除成功
git remote -v //没有出现origin,表示删除成功
将新的远程仓库地址添加到本地
git remote add origin http://xxx.xxx.new.git
验证新的的远程仓库地址是否添加成功
git remote -v //output origin http://xxx.xxx.new.git //出现origin内容表示添加成功
获取新的远程分支
git fetch origin //output From http://xxx.xxx.new.git * [new branch] newBranch1 -> origin/newBranch1 * [new branch] newBranch2 -> origin/newBranch2 * [new branch] newBranch3 -> origin/newBranch3
查看所有的分支(本地旧分支+远程仓库新分支)
git branch -a //output oldBranch1 oldBranch2 oldBranch3 remotes/origin/newBranch1 remotes/origin/newBranch2 remotes/origin/newBranch3
依次删除本地旧分支
git branch -d oldBranch1 git branch -d oldBranch2 git branch -d oldBranch3 //or 强制删除 git branch -D oldBranch1 git branch -D oldBranch2 git branch -D oldBranch3 // output Deleted branch oldBranch1 Deleted branch oldBranch2 Deleted branch oldBranch3
查看删除本地旧分支是否成功
git branch -a //output success remotes/origin/newBranch1 remotes/origin/newBranch2 remotes/origin/newBranch3
切换远程新分支b并创建对应的本地分支
// 格式 git checkout -b 本地分支名 远程分支名 git checkout -b newBranch1 remotes/origin/newBranch1 git checkout -b newBranch2 remotes/origin/newBranch2 git checkout -b newBranch3 remotes/origin/newBranch3 //output success Switched to a new branch 'uat' Branch 'newBranch1' set up to track remote branch 'newBranch1' from 'origin'. ...
查看本地新分支是否创建成功
git branch -a //output success newBranch1 newBranch2 newBranch3 remotes/origin/newBranch1 remotes/origin/newBranch2 remotes/origin/newBranch3
拉取最新代码
git pull
Git远程仓库地址修改后你需要如何做
查看本地现在的远程仓库地址
删除本地现在的远程仓库地址
验证本地现在的远程仓库地址是否删除成功
将新的远程仓库地址添加到本地
验证新的的远程仓库地址是否添加成功
获取新的远程分支
查看所有的分支(本地旧分支+远程仓库新分支)
依次删除本地旧分支
查看删除本地旧分支是否成功
切换远程新分支b并创建对应的本地分支
查看本地新分支是否创建成功
拉取最新代码