当我想在 git 上本地删除一个分支并将其传播到 GitHub 存储库时,我使用这个两步法:
~$ git branch -d [branch_name]
~$ git push origin :[branch_name]
是否有任何命令可以在本地删除分支并自动将此修改传播到 GitHub 上的远程仓库?
最佳答案
git config alias.yourcommandnamehere \
'! f() { git branch -d $1; git push origin :$1; }; f'
git yourcommandnamehere branch_name
请注意,git 不会为内置函数提供别名。 Many of them do have config items提供默认值。
关于linux - 如何通过 1 步将本地分支删除传播到远程 - git, github,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23797257/