gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 19:30:07 26 4
gpt4 key购买 nike

我可以提交大量更改,但没有任何内容可以提交到 github。

只有当我手动点击菜单中的 PUSH 功能时,它才会推送到 github。

如何让它在我提交时自动执行此操作?

这些是我的 VS GIT 设置:

 // 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,

最佳答案

根据 this issue在 GitHub 上,此功能不存在,也不计划添加。

他们建议使用 Git hooks实现此行为。

像这样:

#!/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

可以查看this answer了解更多详情和选项。

关于github - 当我提交更改时,VScode 不会自动推送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44453939/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com