首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >当我提交更改时,VScode不会自动推送

当我提交更改时,VScode不会自动推送
EN

Stack Overflow用户
提问于 2017-06-09 09:17:37
回答 1查看 3.9K关注 0票数 3

我可以提交大量的更改,但是github什么也得不到。

只有当我手动单击它推送到github的菜单中的PUSH函数时,才会这样做。

当我提交时,我如何让它自动完成这个任务?

这些是我的VS GIT设置:

代码语言:javascript
运行
复制
 // Whether git is enabled
  "git.enabled": true,

  // Path to the git executable
  "git.path": null,

  // Whether auto refreshing is enabled
  "git.autorefresh": true,

  // Whether auto fetching is enabled
  "git.autofetch": true,

  // Confirm before synchronizing git repositories
  "git.confirmSync": true,

  // Controls the git badge counter. `all` counts all changes. `tracked` counts only the tracked changes. `off` turns it off.
  "git.countBadge": "all",

  // Controls what type of branches are listed when running `Checkout to...`. `all` shows all refs, `local` shows only the local branchs, `tags` shows only tags and `remote` shows only remote branches.
  "git.checkoutType": "all",

  // Ignores the legacy Git warning
  "git.ignoreLegacyWarning": false,

  // Ignores the warning when there are too many changes in a repository
  "git.ignoreLimitWarning": false,

  // The default location where to clone a git repository
  "git.defaultCloneDirectory": null,

  // Commit all changes when there are not staged changes.
  "git.enableSmartCommit": false,
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-07-04 14:48:58

根据本期 on GitHub的说法,这个特性不存在,也不打算添加。

他们建议使用吉特钩来实现这种行为。

就像这样:

代码语言:javascript
运行
复制
#!/usr/bin/env bash

branch_name=`git symbolic-ref --short HEAD`
retcode=$?

# Only push if branch_name was found (my be empty if in detached head state)
if [ $retcode = 0 ] ; then
    #Only push if branch_name is master
    if [[ $branch_name = "master" ]] ; then
        echo
        echo "**** Pushing current branch $branch_name to origin ****"
        echo
        git push origin $branch_name;
    fi
fi

您可以查看这个答案获得更多详细信息和选项。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44453939

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档