MyTetra Share
Делитесь знаниями!
Alias
Время создания: 19.04.2017 18:15
Раздел: git - Git Mastering Version Control
Запись: xintrea/mytetra_db_mcold/master/base/1492614952gg5vc4galu/text.html на raw.githubusercontent.com

### 3. Alias


```sh

git config <level> alias.<alias name> '<your sequence of git commands>'

git config --global alias.tree 'log --graph --decorate -pretty=oneline --abbrev-commit'

```


```

# level

-- global

```

'global' means any other repository for my user account on this computer will have this command available

For the system level, we will use the --system option. If you don't specify any of these two options, the config will take effect only in the

repository that you are in now.


examples

```

$ git config --global alias.co checkout

$ git config --global alias.br branch

$ git config --global alias.ci commit

$ git config --global alias.st status

$ git config --global alias.cm "commit -m"

$ git config --global alias.unstage 'reset HEAD --'

$ git unstage myfile.txt

$ git reset HEAD myfile.txt

# undo

$ git config --global alias.undo 'reset --soft HEAD~1'

```

> git last

```

$ git config --global alias.undo 'reset --soft HEAD~1'

```

> Advanced aliases with external commands

```

$ git config --global alias.cm '!git add -A && git commit -m'

```

> Removing an alias

```

$ git config --global --unset alias.cm

```

 
MyTetra Share v.0.65
Яндекс индекс цитирования