zl程序教程

您现在的位置是:首页 >  其他

当前栏目

GIT ---- GIT 同步远程库操作

同步Git 远程 操作 ----
2023-09-14 09:15:08 时间

1. 查看分支

1.1 git branch

查看本地分支!

1.2 git branch -a

查看本地和远程所有分支!

1.3 git branch -r

查看远程库分支!

2.同步远程分支

2.1 git fetch

将本地分支与远程保持同步

2.2 git checkout -b 本地分支名 origin/远程分支名

拉取远程分支并同时创建对应的本地分支

2.3 git fetch --all

将本地所有分支与远程保持同步

2.4 git pull --all

拉取所有分支代码

2.5 git push origin --delete [branch_name]

删除远程分支

2.6 git push --set-upstream origin [branch_name]

建立本地到远端仓库的链接

2.7 git push origin [branch_name] --force

强制提交本地分支覆盖远程分支

3. 远程仓库地址操作

3.1 git remote -v

查看远程仓库地址!

3.2 git remote set-url origin url

直接修改远程仓库地址

3.3 git remote rm origin

删除本地远程仓库地址

3.4 git remote add origin url

添加新的仓库地址