Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
For the past 23 years, I’ve been a Linux developer (I started with Linux version 1.2.1). I live in the command prompt. Because of that, I want the prompt itself to look nice, and to provide useful information at a glance. Therefore, I wrote a script called gitprompt, which customizes the prompt. I’ve been using it at work for a while, and a number of my coworkers noticed it and asked for a copy. So since I know there’s at least some amount of interest in it, I’m publishing this brief article about it, in case you want to try it out for yourself.
Here’s what it looks like, in its most basic form:
“21:53” is the time, followed by my username (“enfors”), and the name of my machine (“shodan”). After that, there’s the current directory — nothing unusual so far. The cursor itself is on the next line to make room for long commands.
So, on to the first feature; if a command fails, the prompt will display its exit status in red so you won’t miss it:
Okay, cool. But why is it called “gitprompt”? I thought you’d never ask. As soon as we cd into a git directory, the magic happens:
Being inside a git directory adds extra information at the end of the prompt; “develop” is the current branch, and “Up-to-date” means that nothing has changed since the last commit. So what happens if we add a file? Let’s find out, by creating an empty dummy file called “foo”:
Now, instead of “Up-to-date,” it says “Untracked”, so we know that there is at least one untracked file in the repo. Let’s track it, by adding it:
Neat, now it says “Added” instead. But what happens if we have both untracked and newly added files? Well, let’s add another dummy file, this time called “bar” to find out, shall we?
I could go on, but I think you get it by now.
If this seems useful to you, feel free to go to the project’s Github page, where you’ll find the installation instructions, and grab your own copy.
Why Linux Developers Should Use GitPrompt was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.