git-alias

Parse branch name, initiate commit with name in the commit message

爷,独闯天下 提交于 2019-11-28 14:31:13
My team uses a common naming convention for branch names, which include the Jira task number in the branch name. feature/ACD-1664_update-api-call feature/VZ-1943_new-provider-template hotfix/RV-977_fix-loading-issue I want to create a git alias that will automatically stub out a commit message which includes the Jira task number. Ideally some bash script that will parse the branch name and echo out the commit -m command with the first part of the message pre-created. I need to regex out the commmit message. I need to pull ACD-1664 from feature/ACD-1664_update-api-call Echo this string out into

Git config alias escaping

断了今生、忘了曾经 提交于 2019-11-28 10:20:58
I'm trying to write a git alias that removes from the commit messages the string "[ci skip]" (placed at the end of the message), but I'm having problem with escaping. The alias takes all the commit from the one passed as argument to HEAD . If I run the following command: git filter-branch -f --msg-filter "sed -e \"s/\[ci skip\]$//g\"" master..HEAD it works as expected. Anyway if I create the following alias: unwip = !sh -c 'git filter-branch -f --msg-filter \"sed -e \\\"s/\[ci skip\]$//g\\\"\" $0..HEAD' and I run git unwip master it complains about bad config, but I expect it to behave as the

Parse branch name, initiate commit with name in the commit message

我们两清 提交于 2019-11-27 08:28:30
问题 My team uses a common naming convention for branch names, which include the Jira task number in the branch name. feature/ACD-1664_update-api-call feature/VZ-1943_new-provider-template hotfix/RV-977_fix-loading-issue I want to create a git alias that will automatically stub out a commit message which includes the Jira task number. Ideally some bash script that will parse the branch name and echo out the commit -m command with the first part of the message pre-created. I need to regex out the

Pass an argument to a Git alias command

天涯浪子 提交于 2019-11-27 03:31:16
Can I pass arguments to the alias of a Git command? I have some alias in Git config, like so: rb1 = rebase -i HEAD~1 rb2 = rebase -i HEAD~2 rb3 = rebase -i HEAD~3 rb4 = rebase -i HEAD~4 .... Is it possible to make an rb alias so that git rb <x> works for any <x> ? I tried this alias: rb = rebase -i HEAD~ but then for instance git rb 8 does not work. VonC If you consider the Git Faq section "Git Aliases with argument" , you could do it, but by calling git through a shell: [alias] rb = "!sh -c \"git rebase -i HEAD~$1\" -" I haven't tested it yet, but if you can pass an argument, that would be

Git config alias escaping

ε祈祈猫儿з 提交于 2019-11-27 03:31:00
问题 I'm trying to write a git alias that removes from the commit messages the string "[ci skip]" (placed at the end of the message), but I'm having problem with escaping. The alias takes all the commit from the one passed as argument to HEAD . If I run the following command: git filter-branch -f --msg-filter "sed -e \"s/\[ci skip\]$//g\"" master..HEAD it works as expected. Anyway if I create the following alias: unwip = !sh -c 'git filter-branch -f --msg-filter \"sed -e \\\"s/\[ci skip\]$//g\\\"\

Git Alias - Multiple Commands and Parameters

天涯浪子 提交于 2019-11-26 11:36:32
I am trying to create an alias that uses both multiple Git commands and positional parameters. There are Stackoverflow pages for each, and it would appear painfully obvious to do both, but I am having trouble. As an example, I want to switch to branch foo and perform a status. So in my .gitconfig , I have: [alias] chs = !sh -c 'git checkout $0 && git status' which doesn't work. Whereas something like this will work. chs = !sh -c 'git checkout $0' echoes = !sh -c 'echo hi && echo bye' Any insight would be appreciated. This will work (tested with zsh and bash): [alias] chs = !git checkout $1 &&

Git Alias - Multiple Commands and Parameters

风格不统一 提交于 2019-11-26 02:28:34
问题 I am trying to create an alias that uses both multiple Git commands and positional parameters. There are Stackoverflow pages for each, and it would appear painfully obvious to do both, but I am having trouble. As an example, I want to switch to branch foo and perform a status. So in my .gitconfig , I have: [alias] chs = !sh -c \'git checkout $0 && git status\' which doesn\'t work. Whereas something like this will work. chs = !sh -c \'git checkout $0\' echoes = !sh -c \'echo hi && echo bye\'