bash - Unable to create git alias? -


i want create git alias can run multiple commands @ once.

i typed following terminal:

git config alias.cleanpull "!git reset --hard head; git clean -f; git pull"

i assumed correct syntax following output after entering command (i.e. defining command, not running it):

git config alias.cleanpull "git config cleanpull.q "git push --all origin reset --hard head; git clean -f; git pull" reset --hard head; git clean -f; git pull" usage: git config [<options>]  config file location     --global              use global config file     --system              use system config file     --local               use repository config file     -f, --file <file>     use given config file     --blob <blob-id>      read config given blob object  action     --get                 value: name [value-regex]     --get-all             values: key [value-regex]     --get-regexp          values regexp: name-regex [value-regex]     --get-urlmatch        value specific url: section[.var] url     --replace-all         replace matching variables: name value [value_regex]     --add                 add new variable: name value     --unset               remove variable: name [value-regex]     --unset-all           remove matches: name [value-regex]     --rename-section      rename section: old-name new-name     --remove-section      remove section: name     -l, --list            list     -e, --edit            open editor     --get-color           find color configured: slot [default]     --get-colorbool       find color setting: slot [stdout-is-tty]  type     --bool                value "true" or "false"     --int                 value decimal number     --bool-or-int         value --bool or --int     --path                value path (file or directory name)  other     -z, --null            terminate values nul byte     --name-only           show variable names     --includes            respect include directives on lookup  git: 'pull reset --hard head; git clean -f; git pull' not git command. see 'git --help'. 

the problem here in shell (i guess have bash, it's common, csh or other), not git. bash threat ! symbol specially reference command history. in order use literally have either escape backslash (\!)

git config alias.cleanpull "\!git reset --hard head; git clean -f; git pull" 

or use single quotes

git config alias.cleanpull '!git reset --hard head; git clean -f; git pull' 

for more info see section history expansion in bash manual.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -