When creating a Git alias that points to a function, sometimes Git provides the wrong tab completion by default (e.g. filename completion instead of branch name completion). This is how we can tell Git, which type of completion to use.
I want to be able to type “git open-github-pr” and have my browser open to the GitHub URL to create a Pull Request (PR) for my current branch on the current project I’m working on. Here is how I built this.
When you are using Git commit validation (a.k.a. commit linting) and it fails, it is frustrating to re-type your message. Git stores the commit message that failed validation. You can use this stored message to start your new commit message.
As a developer, I spend a lot of time going back and forth between the command line and Jira tickets. I realized that since I always include the Jira ticket identifier (e.g. `sf-123`) in the branch name (in a reliable position), I could write a git alias to open the corresponding URL. This is how I implemented this behavior.
Never use git push –force. Seriously, don’t use it. You should always use –force-with-lease instead. We’ll look at the problem with –force and how –force-with-lease addresses the issue.
When using Git, sometimes (often) I find myself forgetting to delete local branches after merging them. This command deletes this branches (and I’ve included a Git alias to make it easy to use in the future).
When I’m working on a project using Git, I’m good about deleting local branches that I don’t need anymore. However, I often forget about my remote branches after they are merged. While it is convenient that most of the Git hosting I use makes it easy to show only unmerged branches, this also makes it […]
By default the output of ‘git log’ is not nearly as useful as it could be. By creating a new command ‘git lg’ that uses some of the options available to ‘git log’, we create a much more useful command.