Add aliases to Git commands

Here’s how to add aliases to common Git commands

1 min · Jesstern Rays

Check the status of a Git repository

To check the status of the Git repository. git status We can see a --short or -s version with this command. git status --short For convenience, you can add git st as an alias. git config --global "status --short"

1 min · Jesstern Rays

Clone a repository with submodules

Git commands are different for different versions so be sure to check your Git version. git --version Clone a repository with submodules using the --recurse-submodules flag. This works for Git version 2.13 or higher. git clone --recurse-submodules <remote-repo-url> If the repository has a lot of submodules, then adding the -j8 flag will fetch up to 8 submodules in parallel. git clone --recurse-submodules -j8 <remote-repo-url> Alternatively, first clone the repository and then add the submodules....

1 min · Jesstern Rays

Reset changes in Git

Reverting your changes in Git

1 min · Jesstern Rays

Sign your commits

How to sign your Git commits with a GPG key

3 min · Jesstern Rays

Squash your commits

It’s not uncommon to make several commits during the course of developing your feature. When it’s time to push your code you want to combine all of your commits into one logical commit. When making pull requests and submitting code for review, it’s easier for others to view all of our changes in one commit rather than have them all scattered in numerous commits. To do this, we want to squash all our commits into one commit....

2 min · Jesstern Rays

Using SSH and GPG keys

With most remote Git servers such as GitHub and GitLab, you will see both SSH and GPG keys and you might be wondering what they are used for. SSH keys SSH keys are used for authenticating with the remote Git server without you requiring to key in your username and password. We want to associate an SSH key with your computer’s identity so generate an SSH key for each device. In the event that you lose your computer, you can revoke the SSH key and commits coming from that device will no longer be allowed....

2 min · Jesstern Rays

View changes before committing

Review code changes before staging and committing

2 min · Jesstern Rays

View code changes

View code changes with git diff

1 min · Jesstern Rays