Git Alias: Create Shortcuts for Git Commands
Git aliases allow you to create shortcuts for frequently used Git commands, making your workflow faster and more efficient.
1. Creating a Git Alias
To create an alias, use:
For example:
Now, you can run git st instead of git status.
2. Useful Git Alias Examples
๐น Shorten Common Commands
๐ These aliases allow you to run commands like:
git co main→ Instead ofgit checkout maingit br→ Instead ofgit branchgit cm "Initial commit"→ Instead ofgit commit -m "Initial commit"
๐น Create a Better git log View
๐ Now, running git lg will display a visual history of commits.
๐น Undo Last Commit (But Keep Changes)
๐ Running git uncommit undoes the last commit but keeps your changes.
๐น Clean Untracked Files
๐ git cleanall removes untracked files and directories.
3. Listing All Aliases
To see all configured aliases, run:
4. Removing an Alias
If you want to remove an alias:
For example, to remove git co:
๐น Conclusion
Git aliases save time and reduce typing. Setting up custom aliases allows you to speed up your workflow and work more efficiently.
Do you want help setting up a specific alias? Let me know! ๐

