Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一些方法来防止自己意外地提交本地分支 - 当然,除了 master 分支。有没有简单的方法可以做到这一点?
您可以包装git svn dcommit一个别名并在那里添加一些测试。
git svn dcommit
我在中使用以下别名.gitconfig:
.gitconfig
[alias] safe-dcommit = "!f() { if test \"$(git symbolic-ref HEAD)\" != refs/heads/master; then echo You must be on master branch; else git svn dcommit \"$@\"; fi; }; f" dc = !git safe-dcommit