Git Alias – Multiple Commands and Parameters
This will work (tested with zsh and bash): [alias] chs = !git checkout $1 && git status
This will work (tested with zsh and bash): [alias] chs = !git checkout $1 && git status
string is an alias in C# for System.String. So technically, there is no difference. It’s like int vs. System.Int32. As far as guidelines, it’s generally recommended to use string any time you’re referring to an object. e.g. string place = “world”; Likewise, I think it’s generally recommended to use String if you need to refer … Read more
The syntax for using an alias in an update statement on SQL Server is as follows: UPDATE Q SET Q.TITLE = ‘TEST’ FROM HOLD_TABLE Q WHERE Q.ID = 101; The alias should not be necessary here though.
These are more compact and versatile forms of Hamish’s answer. They handle any mixture of upper and lower case letters: read -r -p “Are you sure? [y/N] ” response case “$response” in [yY][eE][sS]|[yY]) do_something ;; *) do_something_else ;; esac Or, for Bash >= version 3.2: read -r -p “Are you sure? [y/N] ” response if … Read more
Add a “shebang” at the top of your file: #!/bin/bash And make your file executable (chmod +x script.sh). Finally, modify your path to add the directory where your script is located: export PATH=$PATH:/appropriate/directory (typically, you want $HOME/bin for storing your own scripts)
A shell function could help on this: [alias] files = “!f() { git diff –name-status \”$1^\” \”$1\”; }; f” An alias without ! is treated as a Git command; e.g. commit-all = commit -a. With the !, it’s run as its own command in the shell, letting you use stronger magic like this. UPD Because … Read more
Just to reiterate what has been posted for other shells, in Bash the following works: alias blah=”function _blah(){ echo “First: $1”; echo “Second: $2″; };_blah” Running the following: blah one two Gives the output below: First: one Second: two
alias_method can be redefined if need be. (it’s defined in the Module class.) alias‘s behavior changes depending on its scope and can be quite unpredictable at times. Verdict: Use alias_method – it gives you a ton more flexibility. Usage: def foo “foo” end alias_method :baz, :foo
To add to josh’s answer, you may make the alias(es) persistent with the following steps, Create a .bat or .cmd file with your DOSKEY commands. Run regedit and go to HKEY_CURRENT_USER\Software\Microsoft\Command Processor Add String Value entry with the name AutoRun and the full path of your .bat/.cmd file. For example, %USERPROFILE%\alias.cmd, replacing the initial segment … Read more
$ git config –get-regexp alias