rodzyn
rodzyn

Reputation: 113

Intellij Idea git aliases

I have define few aliases in git. How can i using it in Intellij Idea 13.1?

For example:

file: common-configuration

[alias]

new-my-branch = !sh -c 'DATE=$(date +%Y%m%d) && BRANCH_NAME=\"my_super_branch/\"$0\"_\"$DATE && echo $BRANCH_NAME && git checkout -b $BRANCH_NAME && git push-upstream'

Upvotes: 3

Views: 3178

Answers (1)

rodzyn
rodzyn

Reputation: 113

I resolve it that: change the terminal in Intellij Idea to

"P:\Program Files\Git\bin\sh.exe" --login -i

(CTRL+ALT+S -> Terminal -> past in Shell path: "C:\Program Files\Git\bin\sh.exe" --login -i)

In your local directory (e.g C:\Users\john smith)

  1. create .gitconfig
  2. open file and add:

    [alias]

    new-my-branch = !sh -c 'DATE=$(date +%Y%m%d) && BRANCH_NAME=\"my_super_branch/\"$0\"_\"$DATE && echo $BRANCH_NAME && git checkout -b $BRANCH_NAME && git push-upstream'

  3. open new terminal in Intellij Idea and write:

    git new-m[tab]

And you can see alias from auto-complete: git new-my-branch

Upvotes: 8

Related Questions