The git command-line tool has so many options, subcommands, and other features that it’s easy to miss out on some of the best. These features are lesser-known, but will help you take shortcuts and make the most out of Git.
Git worktrees
Git worktree is still one of my favorite features because it avoids so much pain and frustration. Put simply, the worktree command lets you work on multiple branches at the same time.
How useful you find it will depend on how you use branches. If you’re working on larger projects, it’s quite likely that you’ll use feature branches, branches for specific bug fixes, and more. Switching branches while you’re working on them can be cumbersome and is prone to errors.
You can create a new worktree and its branch all in one step:
git worktree add
The last part of the path will be used for the new branch name:
The git branch command will then highlight worktrees in cyan, prefixed with a + symbol:
Git aliases
This feature isn’t a command, although it can help you make itself into one. You’ve probably heard about git aliases before; they’re essentially the same as normal Linux shell aliases, but specifically tailored for git subcommands.
You’ll really appreciate their power once you start using them; if you haven’t already, make today the day you set up your first alias:
git config --global alias.aliases 'config --get-regexp ^alias\.'
This git config command shows the general pattern for creating aliases, and it’s a useful alias itself because it shows you a list of your current aliases. Once you’ve set it up, just run git aliases to see a list of all your current aliases:
The general pattern to set an alias is simply:
git config --global alias.[alias-name] [alias-command]
Note that you should quote your command if it contains spaces. Here are some examples of useful aliases you can set up:
-
alias.dir rev-parse --show-toplevelmakesgit diroutput the root path of the repository you are currently in -
alias.treelog log --all --decorate --oneline --graphmakesgit treelogshow a nicely formatted log with a branch graph and tags. -
alias.last 'log -1 HEAD'makesgit lastshow details of the most recent commit, including its author, date, and full message.
You might find you end up with a lot of aliases for different git log formats. This is because the subcommand is so expressive, with many options, that it’s difficult to remember your favorites.
Git submodules
Git is a vital tool for source control, whether your project is small or large, centralised or distributed. Some of its features are tailored for very specific use cases, however, and the submodule command is one such example.
Git submodules let you include one repository inside another. Although you can achieve something similar by copying the contents of a repo that your code depends on, submodules formalize this and avoid needless duplication.
Submodules may be less necessary for public projects, which often use a package manager like NPM or Cargo to support dependencies. However, for private or personal projects, this can be overkill, so submodules are a useful alternative.
Adding another repo as a submodule is straightforward:
git submodule add url subdir
Here, url references the dependency’s Git URL, which will be used to download its files into the directory named subdir.
Once you’ve added a submodule, you should notice the appearance of a new file named .gitmodules. Just like with .gitignore, you should commit this file to your repository so it’s part of your project’s history and is available to other contributors:
git add .gitmodules subdir
git commit -m "added submodule"
Git will only add a lightweight reference to the submodule via the .gitmodules file, so this is much more efficient than importing all the dependency’s files manually. You can still pull in upstream changes from that dependency, using submodule update:
git submodule update --recursive --remote
The Git GUI
Did you know that Git comes with its own GUI app? OK, it’s not a serious challenger to Fork, GitHub Desktop, or even Lazygit, a TUI equivalent that looks just as good. But this tool is a great option if you like to keep things minimal, and its portability should ensure that it’s available on any system you use.
If your version doesn’t come with the tool (as it didn’t on my macOS system), you can install it using APT:
sudo apt install git-gui
Or you can install it using Homebrew:
brew install git-gui
The tool is most useful when committing code. Its interface splits into four simple panels showing unstaged and staged changes, a diff of the selected file, and a form to enter a message and commit.
The git-gui app definitely won’t replace more advanced, featureful alternatives, but it can be a great way to quickly review and commit your code.
The last-modified command
Ending on a more experimental note, this final feature is a new one, so you should bear in mind that it’s subject to change. However, you can start using it right away (in Git 25.2+) and consider how it may fit into your workflow.
This subcommand is pretty simple: it lists the git-controlled files in your current directory, alongside the commit ID containing their most recent change.
By default, last-modified shows just the files in your current directory. Any directories will show the commit ID of the most recently changed file they contain. However, with the -r option, it will instead show all files below your current directory, including those in directories.
git last-modified
As with many git commands, you can limit last-modified’s output by revision or path, so you can tailor it to your exact needs. The output may be most useful in scripts and when building interfaces similar to GitHub’s file browser.

