git Tutorials
How to Get the Current Branch Name with git
Most developers spoil themselves with fun command line utilities to make their work easier and more efficient. One such command line helper allows developers to always show the git branch in the command line. How can you get the current branch? With...
git Force Push
Rebasing is a frequent task for anyone using git. We sometimes use rebasing to branch our code from the last changes or even just to drop commits from a branch.Oftentimes when trying to push after a rebase, you'll see something like the following:Commonly developers...
More Awesome Git Aliases
In the last article in this series, Awesome Git Aliases, we took a look at some awesome aliases for Git. However, the true power of Git aliases comes from writing custom scripts. These allow you to build Git commands that can do anything you can...
How to Flatten git Commits
One of my least favorite tasks as a software engineer is resolving merge conflicts. A simple rebase is a frequent occurrence but the rare massive conflict is inevitable when many engineers work in a single codebase. One thing that helps me deal with large...
Awesome Git Aliases
Git is an amazingly powerful tool. It can keep track of all the code you write, let you organize your work into different branches, help you seamlessly work with other developers, and even let you time travel and make changes.But wouldn't it be awesome if Git...
How to Install a NPM Module from GitHub Branch
In my journey to work more quickly with a project containing loads of dependencies, I've come across a few techniques I've not needed to use before. I previously wrote about How to Push to a Git Remote Branch of a Different Name -- this...
How to Push to a Git Remote Branch of a Different Name
Git is one of those tools that I've always known just enough about to be dangerous, and usually tend to learn new skills when I'm in a position to truly need them. Shockingly enough it has taken me roughly 15 years of using git for...
git: Remove Untracked Files
I've always said that I know just enough about git to get the job done, but also do something destructive. Nothing embodies that more than my recent mistake. I somehow found a git repository full of untracked files and
git stash
wouldn't fix it.Detect Changed Files with git
There are numerous reasons to want to know which files have been added or modified in a git repository, one of which is your text editor highlighting those files. Another use case is running tasks against only files which are presently changed, like lint or...
How to Detect the Default Branch in a git Repository
Over the past few years, many engineering teams have switched their default git branch name from
master
to a different, potentially less offensive term. I'm all for choosing to name your default branch whatever you'd like, but not having a universal default branch name can...