Git Product home page Git Product logo

git-gud's Introduction

git-gud

These benchmarks aim to show the fastest way to get information from git. Getting fast git info is particularly important if you are trying to add information to the PS1 property of a terminal. All the tests are conducted in the git repo and are the fastest of 5 executions.

Git Current Branch

The fastest way to get a git repo's current branch is: cat .git/HEAD | awk -F refs/heads/ '{ print $2; }'

Try it yourself!

$ curl -sSL https://github.com/jareddlc/git-gud/raw/master/git-branch-current.sh | sh

Commands that need additional formatting without the formatting (base speed)

Command Real Time
git branch 0m0.015s
git status 0m0.027s
cat .git/HEAD 0m0.004s
git symbolic-ref HEAD 0m0.007s
git name-rev HEAD 0m0.040s

Commands that need additional formatting

Command Real Time
git branch | grep * | awk '{ $1=$1; print }' | tr -d "* " 0m0.016s
git branch | grep * | cut -d ' ' -f2- 0m0.016s
git branch | sed -n '/* /s///p' 0m0.014s
git status | head -1 | awk '{ print $3; }' 0m0.026s
cat .git/HEAD | awk -F refs/heads/ '{ print $2; }' 0m0.004s
git symbolic-ref HEAD | awk -F refs/heads/ '{ print $2; }' 0m0.008s
git name-rev HEAD | awk '{ print $2; }' 0m0.039s
git describe --all | awk -F heads/ '{ print $2; }' 0m0.016s

Commands that dont need additional formatting

Command Real Time
git symbolic-ref --short HEAD 0m0.008s
git name-rev --name-only HEAD 0m0.039s
git rev-parse --abbrev-ref HEAD 0m0.008s

Contributing

Have a faster method? Submit a pull request and add it to the benchmarks.

git-gud's People

Contributors

jareddlc avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.