Since the code highlighter on this post does not capture the terminal output highlighting, here’s the last two commands in a screenshot, showing how git status and git status -sb share the same color highlighting, but only format the output differently. Playing around with git is a great way to learn! You can simply follow along command by command in your own terminal. The code examples are intentionally a bit verbose to keep them reproducible. " to discard changes in working directory) Nothing added to commit but untracked files present (use "git add" to track)ģ files changed, 0 insertions(+), 0 deletions(-) $ git commit -m "Initial commit" -allow-empty Initialized empty Git repository in /home/darth/projects/status-demo/.git/ Let me illustrate on a straightforward example where we simply create three file f1, f2, f3, modify some of them, and look at how the output of git status differs from git status -sb (I tried to make the example self-contained so you can try it yourself): Everyone who ever tried git had to write git status at some point, yet of all the people I’ve met, only a few know of its extremely useful variant git status -sb. We’re going to skip ahead alphabetically and cover git status right now, as it will be useful in explaining the other commands. Since (almost) all of our aliases will be prefixed with g (such as ga, gco, gc, …) they will be just as easy to discover if you ever forget them as their git config alias counterpart. The reason is simple, it is much easier and faster to type gco than git co, which makes git usage more enjoyable. git config -global checkout), but rather plain shell aliases such as alias gco="git checkout". Contrary to what some people might thinks, we won’t use the builtin git alias functionality using git config (that is e.g. A completel list of aliases presented in the article is summarized at the end of the article.Įach section will first briefly describe the command, some of its useful flags, and then suggest a set of mnemonic aliases with their usage. Instead, we’ll look at the most common operations and useful flags, with the goal to create a set of bash or zsh aliases for daily use. We’re not going to cover how git works in depth. This post is a short guide to making your git usage a little more efficient.
0 Comments
Leave a Reply. |