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.
在工作中,我修复某些东西的流程是创建一个分支git checkout -b {GITUSERNAME}/ticket-{TICKET-NUMBER},例如git checkout -b oscar/ticket-1234. 我想知道是否有一种方法可以做到,这样我就可以git nt 1234创建一个 1234 的“新票分支”,然后git cot 1234“结帐票 1234”。
git checkout -b {GITUSERNAME}/ticket-{TICKET-NUMBER}
git checkout -b oscar/ticket-1234
git nt 1234
git cot 1234
这会做到的。添加--globalafterconfig使其成为全局:
--global
config
git config alias.nt '!f() { git checkout -b $(git config user.name)/ticket-${1}; }; f' git config alias.cot '!f() { git checkout $(git config user.name)/ticket-${1}; }; f'
请注意,这仅在您user.name是一个词时才有效!
user.name