我可以提交大量的更改,但没有任何内容可以访问github。
仅当我从推送到github的菜单中手动点击PUSH功能时才会这样。
我提交时如何自动执行此操作?
这些是我的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,
答案 0 :(得分:2)
根据GitHub上的this issue,此功能不存在,也不打算添加。
他们建议使用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了解更多详情和选项。