Skip to content

Instantly share code, notes, and snippets.

@somidad
Last active April 10, 2017 16:28
Show Gist options
  • Save somidad/3759c8289ccc9376d56550f14ace58bb to your computer and use it in GitHub Desktop.
Save somidad/3759c8289ccc9376d56550f14ace58bb to your computer and use it in GitHub Desktop.
A shortcut to git root
# This git alias allows you to move
# to the root of a local git repository
# (if you are in the repo)
# define a shortcut to git root
git config --global alias.root 'rev-parse --show-toplevel'
# Usage: go to the git root
cd $(git root)
# Usage: add all under the git root
git add $(git root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment