A lot of my time is spent in Terminal and a majority of it is spent typing Git commands. I created a set of keyboard shortcuts with Bash aliases and functions to speed up my workflow and save me hundreds of keystrokes every day.
Git Bash is offered to provide a terminal Git experience. What is Git Bash? Git Bash is an application for Microsoft Windows environments which provides an emulation layer for a Git command line experience. Bash is an acronym for Bourne Again Shell. A shell is a terminal application used to interface with an operating system through written. 2 days ago Gamestonk Terminal is an awesome stock market terminal that has been developed for fun, while I saw my GME shares tanking. But hey, I like the stock 💎 🙌. The implementation (in python) allows to easily add more commands, and expand on their configuration. Feel free to request features, I'll be happy to work on them on my spare time. Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users. It includes many of the features most frequently requested by the Windows command-line community including support for tabs, rich text, globalization, configurability, theming & styling, and more.
- Head over to the Windows Terminal build on Github. Under the ‘Code' tab, click ‘Releases'. You can directly visit the releases tab here. The latest stable release of Windows Terminal will be available right at the top of the page (currently v1.0.1401.0).
- Windows Terminal Profile. GitHub Gist: instantly share code, notes, and snippets.
Git Bash Aliases and Functions
Git allows you to set aliases but they're limited and only save you a few keystrokes (i.e. instead of git checkout
you can type git co
, but you still have to type git
). Since Bash is Terminal's default command-line interpreter, you can also set Bash aliases to reduce your keystrokes even further.
Here's my list of Git Bash aliases and functions. To use them as your own, just add them to the file you store your aliases/functions. (i.e. ~/.bash_profile
or ~/.bashrc
)
Notes: If you've never set an alias before, don't know where to put them, or have no clue what I'm talking about, read my post on Terminal/Bash Command-Line Shortcuts with Aliases before continuing.
When copy & pasting, it's important to keep the spacing. (i.e. for aliases, there must be no spaces before and after the equal signs, and for functions, there must be a space after the opening curly bracket of the declaration and a semicolon after the command. Don't forget to reload your file (source ~/.bash_profile
) or restart Terminal after making changes.
You can quickly see how these aliases can save you keystrokes. Most of the aliases are pretty straight forward—for example, instead of git add assets/css/screen.css
, you can run:
or instead of git checkout -b
:
There are a few that are a but more custom. I use a couple of variations of git log
that I find more useful. gld
is a detailed, one-line view of git log
:
Fear for sale: the house on black river 1 0. while glg
is a detailed, decorative graph view of git log
:
By default gm
, the alias for git merge
, defaults to --no-ff
(no fast-forward)—many times I have more than 1 feature branch in development, each of those branches has more than 1 commit, and I feel that the history of the merges are important.
Aliases are great but are limited in scope, which is why I had to use a function for glf
, my Git log find function. Occasionally I want to search for a commit by the commit message. Using glf
:
You should get an output like follows:
I realize there are more possibilities for other Git commands, but for anything outside of these, I run them manually; however, feel free to add your own or make modifications to your liking.
May these aliases and functions spare you thousands of keystrokes and extend your life expectancy. If you have any alias or functions that are particularly useful, I'd love for you to share it with me.
Github Terminal Login
When you are working inside a Git repository it is important to realize what is the currently checked out Git branch.
You can make it easier to track where you are, by showing the name of the current Git branch in the terminal (command prompt). Exactscan pro 15 12 14 – powerful fast document scanning.
In the almost any Linux distribution, including Ubuntu and CentOS, this can be easily done by configuring a primary prompt string, that is controlled via a special shell variable PS1
Cool Tip: Have forgotten the meaning of some term in Git? Not a problem! Simply read and bookmark this article! This article →
Show Git Branch In Terminal
To display the current prompt setting, run:
Sample output:
May these aliases and functions spare you thousands of keystrokes and extend your life expectancy. If you have any alias or functions that are particularly useful, I'd love for you to share it with me.
Github Terminal Login
When you are working inside a Git repository it is important to realize what is the currently checked out Git branch.
You can make it easier to track where you are, by showing the name of the current Git branch in the terminal (command prompt). Exactscan pro 15 12 14 – powerful fast document scanning.
In the almost any Linux distribution, including Ubuntu and CentOS, this can be easily done by configuring a primary prompt string, that is controlled via a special shell variable PS1
Cool Tip: Have forgotten the meaning of some term in Git? Not a problem! Simply read and bookmark this article! This article →
Show Git Branch In Terminal
To display the current prompt setting, run:
Sample output:
Open the ~/.bashrc
file with your favorite text editor and add the following lines:
git_branch()
Set Up Github Terminal
is a function, that prints the name of the current Git branch in the round brackets.We set the PS1
variable and place the function git_branch()
inside it to display the Git branch in the terminal prompt.
The function inside the PS1
variable must be in the following format: $(git_branch)
.
Load the ~/.bashrc
to apply changes for the current session without login/logout:
From now, as only you enter a directory that is tracked by Git, you will see the current Git branch name in the terminal prompt:
Github Terminal Prompts Disabled
To prettify your command prompt you can colorize a Git branch name by wrapping $(git_branch)
into ANSI escape codes, like 033[00;32m]$(git_branch)[033[00m]
(green foreground color, normal characters):
Cool Tip: Choose the best COLORS and styles for your terminal prompt! Read more →
The terminal prompt looks quite pretty now: