What does git sync do in VSCode

风格不统一 提交于 2020-11-26 04:58:05

问题


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


回答1:


From the VSCode online help:

Given that your repository is connected to some remote and that your checked out branch has an upstream link to a branch in that remote, VS Code offers you useful actions to push, pull and sync that branch (the latter will run a pull command followed by a push command).

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

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

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.

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

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




回答2:


Visual Studio Code sync sequence : PUSH + PULL screen shot from VS Code

Visual Studio 2019 sync sequence : PULL + PUSH screen shoot from Visual Studio 2019 documentation



来源:https://stackoverflow.com/questions/36878344/what-does-git-sync-do-in-vscode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!