git Tutorials
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...Automatically Rebase GitHub Pull Requests
Working on an open source project with a thriving contribution community is one of the great joys I have at Mozilla. In leading this charge, I get to meet amazing people of all different skill sets and interests, as well as different points of...
Detect git Directory with Bash
One interesting aspect of working at Mozilla is that Firefox lives in a mercurial repository while several other projects live on GitHub in a git repository. While most focus on either Firefox or another project, I switch between both, leaving me running
git
commands inside...5 Essential git Commands and Utilities
For many of us, git and GitHub play a huge role in our development workflows. Whenever we have a tool that we need to use often, the more fine-tuned we can make that tool, the faster we can get things done. The following are five git...
How to Set a Default Commit Message
Having a default commit message is really useful for a number of reasons:It can formalize your commit messagesIt serves as a good reminder for the information you should add to your commit message, like issue numberIf you set it to "Drunk AF, don't accept this"To set...
Mercurial Tips
While most of the world seems to be using git for version control, Mozilla continues to use Mercurial (
hg
) to manage the Firefox source code. As a git and GitHub lover, it took me a while to get used to Mercurial. I...