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 alias.st "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

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

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