# Some useful git aliases

DevFeed: [Some useful git aliases](<https://devfeed.tech/articles/some-useful-git-aliases-33368.md>)

Original publisher: [Read original article](<https://timkellogg.me/blog/2011/05/13/some-useful-git-aliases>)

Published: 2011-05-13T00:00:00Z

Content type: tutorial

Language: en

Sources: [Tim Kellogg](<https://devfeed.tech/sources/tim-kellogg.md>)

Topics: [Git](<https://devfeed.tech/topics/git.md>), [Submodules](<https://devfeed.tech/topics/submodules.md>)

Tags: [config](<https://devfeed.tech/tags/config.md>), [git](<https://devfeed.tech/tags/git.md>), [git-aliases](<https://devfeed.tech/tags/git-aliases.md>), [global](<https://devfeed.tech/tags/global.md>), [graph](<https://devfeed.tech/tags/graph.md>), [submodules](<https://devfeed.tech/tags/submodules.md>), [useful](<https://devfeed.tech/tags/useful.md>)

## AI overview

A collection of Git aliases for displaying formatted repository history, pulling updates for a repository and its submodules, and resetting repositories to a clean state by removing changes and untracked or ignored files.

## Source excerpt

Git aliases are a great way to do more with less typing. Our team uses submodules to an extent which can sometimes be confusing. Some of these aliases help to clarify behavior. These are a few of my favorites.git lgThis gives you a nicely formatted semi-graphical log view with users, branches, and remotesgit config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %C(green)%an%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" git latestThis does a git pull on the current repository as well as all submodulesgit config --global alias.latest '!sh -c "git pull && git submodule foreach \"git pull\""'git virgin (getting to a pure state)This will reset your changes and delete all untracked and ignored files (includes bin/ and obj/ directories)git config --global alias.virgin '!sh -c "git reset HEAD --hard && git clean -fXd && git clean -fd"'git harem (a whole lot of virgins)This does a virgin for your repository as well as all submodulesgit config --global alias.harem '!sh -c "git virgin && git submodule \"git harem\""'