Questions tagged [git-alias]

With aliases, you can avoid typing the same commands over and over again. Aliases were added in Git version 1.4.0.

To show how to use Git aliases, suppose you wish you could write git ci instead of git commit. You can achieve this by adding the following section to ~/.gitconfig:

[alias] ci = commit

Some people are uncomfortable editing the config file themselves. They can edit the config by calling git config alias.ci commit instead.

If you want to have the alias available everywhere on your local machine, you can either - edit ~/.gitconfig, or - use the --global flag:

git config --global alias.ci commit

Read the Git SCM Wiki for technical details.

116 questions
0
votes
1 answer

How to add custom option to git command?

The company I work for is imposing some requirements on our git messages. Our branch names follow the format /. We are required to prepend our commit messages with . I would like to add a custom…
justaguy
  • 29
  • 3
0
votes
1 answer

Read command not working with Git aliases

sp = "!echo name && read name" I've added this to my aliases list. When I run it "name" is printed as expected and I can input something into read; but on carriage returning and trying echo $name, nothing's there. It works fine when I directly run…
volls
  • 3
  • 1
0
votes
2 answers

How to git alias this git complex git command with single and double quotes inside

Im trying to create a git alias to this command: git branch -vv | grep ': gone]'| grep -v "\*" | awk '{ print $1; }' | xargs -r git branch -d I've tried different things: enclosing the command with "", adding ! is needed for the pipes... but I…
Sergiodela
  • 43
  • 6
0
votes
1 answer

git log alias with parameters not woring

I have this alias for git setup which is working. git config alias.migrations 'log' But when I add a parameter its not working correctly. git config alias.migrations 'log -- **/Migrations/' Any ideas? So when I do git log -- **/Migrations/ I get…
VivekDev
  • 20,868
  • 27
  • 132
  • 202
0
votes
1 answer

Use awk in git alias: alias to delete remote branch by full local ref name `git push -d remotes/remote-name/topic/branch`

Why do I want git push -d remotes/remote-name/topic/branch? It's the format that you get in gitk, often I find remote branches in gitk that I want to delete. Right click the branch name in gitk, copy and do something like git nuke…
Dmitry Avtonomov
  • 8,747
  • 4
  • 32
  • 45
0
votes
0 answers

Bash script that runs in repl.it gives syntax error when in git alias

I'm trying to write a bash script for a git alias, to automate something. I've written the script in repl.it, and it works without issue. However when I've taken the script and put it into my .gitconfig, and reduced it to a single line I'm now…
Jake12342134
  • 1,539
  • 1
  • 18
  • 45
0
votes
1 answer

can not use some of my aliases with bare repo

I have some aliases like: add-and-commit = !git add -A && git commit -m last = !git --no-pager log -1 --oneline stash-and-reset = !git stash && git reset --hard HEAD I track my dotfiles with a bare repo. d = !git…
Ahmad Ismail
  • 11,636
  • 6
  • 52
  • 87
0
votes
1 answer

git - multiline function as alias is not working

I have written a function which beautify the git log output (to solve the problem mentioned in different color for data and time in git log output). function gl() { my_date=(); my_time=(); while IFS= read -r line; do my_date+=( $(date…
Ahmad Ismail
  • 11,636
  • 6
  • 52
  • 87
0
votes
2 answers

Creating a git alias containing bash command substitution and an argument

Got this: git diff $(git status -s | awk 'FNR == $LINE_NUM {print $2}') ...where line number is the file output by status. Now I want to create an alias for this command in .gitconfig: [alias] diff-num = $WHAT_SHOULD_I_PUT_HERE? I want this alias…
StevieD
  • 6,925
  • 2
  • 25
  • 45
0
votes
1 answer

Git output "Submodule registered for path" mixed with aliases config

(Originally asked on Git mailing list and on Git For Windows mailing list, so far without any response.) Problem While running git clone --recurse-submodules https://repo command, I noticed a strange output from git command during initialisation of…
mloskot
  • 37,086
  • 11
  • 109
  • 136
0
votes
1 answer

Git alias referencing commands executed from a subdirectory of a repo

Two git functions defined in .gitconfig (using alias) create-file = "!f() { for name in \"$@\"; do echo $name>$name.txt; done; }; f" m-commit = "!f() { for name in \"$@\"; do git create-file $name; done; }; f" git m-commit a b c This runs ok from…
aniecki
  • 11
0
votes
2 answers

Capture current branch name and delete it using Git alias on Windows?

Currently I'm using this alias to fetch master in the background and then switch to it. This way Visual Studio works the fastest for me: [alias] fetch-checkout = !git fetch -p && git fetch origin master:master && git checkout master What I'd like…
abatishchev
  • 98,240
  • 88
  • 296
  • 433
0
votes
1 answer

Git alias does not print output of command

I have the following git alias [alias] remaster = !"git checkout $1 & git diff-tree -r --patch --diff-filter=DM $1..master" When using the above command by hand I get the following stdout: $ git diff-tree -r --patch development..master…
xetra11
  • 7,671
  • 14
  • 84
  • 159
0
votes
3 answers

Change git command for example git push like gp or other shortform

Now i use ubntu 17.10. How to change git command for example git add . command like ga, git commit command like gc git push commans lije `gp other example like $ git add command like $ ga when i typing ga then it work like git add
chirag sorathiya
  • 1,223
  • 8
  • 29
0
votes
1 answer

git alias not logging only the branch i want

I've created a test alias and in this alias, i want to be able to log only the current branch i'm on (bear in mind this is a simplified version of the log, the final one has way more details, colours and so on). My alias looks like this: test =…
Nick
  • 13,493
  • 8
  • 51
  • 98