kag*_*kij 25 git push visual-studio-code
是否有可能在自动提交后进行git push?现在我需要在手动提交后点击push,这不是很舒服.
Jos*_*ger 31
更新2018-12-20
最新版本的VS Code具有在提交时推送或同步的设置.
git.postCommitCommand
旧的解决方法
我也想念这个.这是目前的"解决方法" -
code .git/hooks/post-commit
复制并粘贴以下内容 -
#!/usr/bin/env bash
branch_name=`git symbolic-ref --short HEAD`
retcode=$?
non_push_suffix="_local"
# Only push if branch_name was found (my be empty if in detached head state)
if [ $retcode = 0 ] ; then
#Only push if branch_name does not end with the non-push suffix
if [[ $branch_name != *$non_push_suffix ]] ; then
echo
echo "**** Pushing current branch $branch_name to origin [i4h_mobiles post-commit hook]"
echo
git push origin $branch_name;
fi
fi
Run Code Online (Sandbox Code Playgroud)
确保它是可执行的 -
chmod +x .git/hooks/post-commit
再试一次.
Creds:
我使用 Gitlens 扩展来更轻松地推送提交。
这就对了。它很简单,使用起来非常快,而且您根本不需要 CLI。
VSCode 的 Git 前端似乎没有内置类似的东西,但有一个选项可以删除安全检查。 "git.confirmSync": false
使用 VSCode 内置的推送/远程同步时将删除确认对话框。
@Mistermatt 的链接看起来像你所要求的,但我在盲目地推动自己方面遇到了太多问题:)。
归档时间: |
|
查看次数: |
6051 次 |
最近记录: |