如何平衡 Visual Studio 2017 本地存储库与 Visual Studio 在线 Git 存储库?
How equalize Visual Studio 2017 local repository with Visual Studio Online Git repository?
我创建了一个 Visual Studio Team Services Git 存储库。
在我本地 Visual Studio 2017 年。我将项目发送到此(第一次提交)。一切顺利
我创建了一个本地分支来修改项目,在VSTS上我也创建了这个分支。
代码修改后,我将代码发送到origin/Heineken分支并在线进行了pull request。
一切就绪,Heineken 分支移至 master,此后 Heineken 在 VSTS 中被删除。
现在 Visual Studio 丢失了,说我 Visual Studio Team Foundation git 分支 'Heineken' 在远程存储库中找不到。
不知道怎么才能让自己的VS等同于VSTS
有小费吗?
这是一个常见的 Git 陷阱,请参阅 How do you stop tracking a remote branch in Git? 以获得完整答案。简短的回答是打开命令提示符并键入
git checkout Heineken
git branch --unset-upstream
VS 显示“Branch 'Heineken' was not found in the remote repository
”的原因是分支 Heineken
在远程仓库中被删除,但在本地仓库中没有删除。
使用 VSTS git 库平衡本地库的步骤如下:
1。删除本地 Heineken 分店
首先可以checkout到不同的分支(比如checkout到master
分支),然后删除本地Heineken
分支(在VS中右击本地Heineken
分支并删除)。
2。更新远程分支以修剪 VSTS git 回购删除分支 Heineken
要修剪在远程仓库中删除的分支 Heineken
,您可以按照以下任一选项操作。
由 git 命令行修剪:
在本地gitrepo目录下,可以执行命令:
git fetch -p
因此删除的分支Heineken
将从remotes/origin
移出。
在 VS 中修剪:
在 Team Explorer -> Settings -> Global Settings -> 将选项 Prune remote branches during fetch 设置为 True -> update。
然后点击fetch(比如Team Explorer -> sync -> fetch),删除的分支Heineken
将不会再显示在remotes/origin
下
我创建了一个 Visual Studio Team Services Git 存储库。
在我本地 Visual Studio 2017 年。我将项目发送到此(第一次提交)。一切顺利
我创建了一个本地分支来修改项目,在VSTS上我也创建了这个分支。
代码修改后,我将代码发送到origin/Heineken分支并在线进行了pull request。
一切就绪,Heineken 分支移至 master,此后 Heineken 在 VSTS 中被删除。
现在 Visual Studio 丢失了,说我 Visual Studio Team Foundation git 分支 'Heineken' 在远程存储库中找不到。 不知道怎么才能让自己的VS等同于VSTS
有小费吗?
这是一个常见的 Git 陷阱,请参阅 How do you stop tracking a remote branch in Git? 以获得完整答案。简短的回答是打开命令提示符并键入
git checkout Heineken
git branch --unset-upstream
VS 显示“Branch 'Heineken' was not found in the remote repository
”的原因是分支 Heineken
在远程仓库中被删除,但在本地仓库中没有删除。
使用 VSTS git 库平衡本地库的步骤如下:
1。删除本地 Heineken 分店
首先可以checkout到不同的分支(比如checkout到master
分支),然后删除本地Heineken
分支(在VS中右击本地Heineken
分支并删除)。
2。更新远程分支以修剪 VSTS git 回购删除分支 Heineken
要修剪在远程仓库中删除的分支 Heineken
,您可以按照以下任一选项操作。
由 git 命令行修剪:
在本地gitrepo目录下,可以执行命令:
git fetch -p
因此删除的分支
Heineken
将从remotes/origin
移出。在 VS 中修剪:
在 Team Explorer -> Settings -> Global Settings -> 将选项 Prune remote branches during fetch 设置为 True -> update。
然后点击fetch(比如Team Explorer -> sync -> fetch),删除的分支
Heineken
将不会再显示在remotes/origin
下