Git gives us hooks in order to get our work done and further automate our process. In this hands-on coding lab, you will dive deep into the hooks that are available in git. When is it coming? This lab is in the planning stages. It will be released episode-by-episode in June.
In Git Contributing, you learned how to delete a local branch. The command of -D is fairly straightforward. But what if you want to delete both the local and remote branches. Let’s build an alias.
In order to build complex aliases, we want to open up the global .gitconfig file in the text editor that is wired to git. Then we’ll add some commenting to provide more context and details for our aliases. If you have not yet wired up your text editor to git, I highly….highly….highly recommend that you do so. Why? The main reason is for writing more detailed commit messages as well as doing rebasing too. Check out this lab for a Mac or Windows to wire yours up.
Let’s tame git. Let’s create a rich set of commands and shortcuts that make sense and are intuitive. Let’s build a set of scripts that are callable by a single command, such as `git uncommit` or `git rollback`, i.e. commands that wrap up repetitive tasks and automate them via a single command. In this hands-on coding lab, you’ll build a rich collection of these commands via git aliases and bash scripting to git you more productive.
There are times when you are working on a change and then realize that you’ve gone in the wrong direction. At that point, you want to rollback your project back to the last commit, i.e. meaning you want to delete all of the changes and return your codebase back to the last commit. There are multiple steps to do this task as you need to delete everything in the staging and working areas. Let’s build an alias.
Recall from Simply Git and Git Contributing how to commit changes. It is a two-step process of adding the changes from working into staging and then running git commit to move from staging into the storage (commit) area. Git gives you a way to combine those steps into one step. Typically, my workflow is: Commit the changes Pop open the editor Add my commit message Clear off the command line console View the status display View the log That’s a lot of steps to type over and over again. Let’s build a complex alias to give us one command git […]
Imagine that you are working along on a change and then decide you need to rename the branch. Git gives you an option to move a branch to a new branch. But like most git commands, it’s not intuitive or rememberable. Let’s build an alias.
In Git Contributing, you learned how to create and checkout a new branch. I don’t know about you, but I find the command and option confusing. Let’s build an alias.
In the last episode, I warned you that fixing your last commit message when you have changes in the working or staging area is problematic. We can solve that problem by staging all of the changes before we fix the message and then restoring them after we’re done. Let’s build an alias.
You know that you can use git status to view what is currently in the working and staging areas. In this episode, let’s make an alias for a less verbose status.