If you've ever browsed the git manual (or run man git
), then you'll have noticed there's a whole lot more to git than what most of us use on a daily basis. A lot of these commands are incredibly powerful and can make your life a lot easier (others are a bit niche, but still good to know).
This post outlines 20 of my favourite under-used git features, which you can use to level up your development process, impress your colleagues, help you answer git interview questions, and most importantly - have fun with!
Discover: Super Useful CSS Resources
Here are 20 Git commands that you may not be familiar with:
-
git stash
- This command allows you to temporarily save changes that are not ready to be committed, and switch to a different branch. You can later reapply the changes withgit stash apply
. -
git stash list
- This command lists all of the stashes that you have saved withgit stash
. -
git stash show
- This command shows the changes that are contained in a specific stash. -
git stash drop
- This command removes a specific stash from the stash list. -
git stash clear
- This command removes all stashes from the stash list. -
git cherry-pick
- This command allows you to apply a specific commit from one branch to another.
Discover: 20 JavaScript Concepts Every Developer Should Know
-
git rebase
- This command allows you to reapply commits on top of another base tip. -
git bisect
- This command helps you find the commit that introduced a bug by performing a binary search through the commit history. -
git blame
- This command shows you the last person to modify each line in a file, along with the commit that made the change. -
git grep
- This command allows you to search for a pattern within your repository. -
git shortlog
- This command shows a summary of commits grouped by author. -
git describe
- This command shows a human-readable description of a commit, based on the closest tag. -
git show-branch
- This command shows a summary of branches and their commits. -
git log --graph
- This command shows a visual representation of your commit history, with branches and merges. -
git clean
- This command removes untracked files from your repository. -
git submodule
- This command allows you to include other Git repositories within your repository as subdirectories. -
git stash branch
- This command creates a new branch from your stash, and removes the stash. -
git cherry
- This command shows a list of commits that are in one branch, but not in another. -
git ls-files
- This command lists all of the files in your repository. -
git merge --squash
- This command merges multiple commits into a single commit, without creating a merge commit.
Follow Us On : Instagram.... Twitter .... Facebook.... Telegram .... Website
I hope these Git commands are useful to you! Let me know if you have any questions.
Discover: Why do Programmer Care About Set Theory
Top comments (0)