git sync在VSCode中做什么 [英] What does git sync do in VSCode

查看:184
本文介绍了git sync在VSCode中做什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio代码中同步更改时,实际上会运行哪些命令?

What commands are actually run when you Synchronise Changes in Visual Studio Code?

推荐答案

VSCode联机帮助:

鉴于您的存储库已连接到某个远程站点,并且您签出的分支具有到该远程分支机构的上游链接,VS Code为您提供了有用的操作来推动,拉动和同步该分支机构(先执行拉动命令,然后再执行推动命令).

看来,如果您在给定分支上运行同步更改,它将执行以下操作:

It appears that if you run synchronize changes on a given branch, it will do the following:

git pull origin someBranch
git push origin someBranch

按@FelikZ的评论,将pull --rebase设置为git pull的默认行为的一种方法是通过添加以下内容来配置.gitconfig文件:

Per the comment by @FelikZ one way to make pull --rebase the default behavior for git pull would be to configure your .gitconfig file by adding the following:

[pull]
    rebase = true

然后,当VSCode插件发出git pull时,默认情况下应使用rebase策略.如果您点击上面的链接并滚动到"Git补丁/差异模式"部分,您将看到一个截屏,其中实际显示了配置Git以通过rebase拉动.

Then, when the VSCode plugin issues a git pull, it should use the rebase strategy by default. If you follow the above link and scroll to the section "Git patch/diff mode," you will see a screen capture which actually shows configuring Git for pulling via rebase.

更新:从v1.28开始,现在有了git.rebaseWhenSync设置.从发行说明:

Update: As of v1.28 there is now a git.rebaseWhenSync setting. From the release notes:

git.rebaseWhenSync设置可让您将Sync命令配置为在运行时始终使用rebase而不是merge.

The git.rebaseWhenSync setting will let you configure the Sync command to always use rebase instead of merge when running.

这篇关于git sync在VSCode中做什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆