Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      CodeSOD: A Unique Way to Primary Key

      July 22, 2025

      BrowserStack launches Figma plugin for detecting accessibility issues in design phase

      July 22, 2025

      Parasoft brings agentic AI to service virtualization in latest release

      July 22, 2025

      Node.js vs. Python for Backend: 7 Reasons C-Level Leaders Choose Node.js Talent

      July 21, 2025

      The best CRM software with email marketing in 2025: Expert tested and reviewed

      July 22, 2025

      This multi-port car charger can power 4 gadgets at once – and it’s surprisingly cheap

      July 22, 2025

      I’m a wearables editor and here are the 7 Pixel Watch 4 rumors I’m most curious about

      July 22, 2025

      8 ways I quickly leveled up my Linux skills – and you can too

      July 22, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025
      Recent

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025

      Zero Trust & Cybersecurity Mesh: Your Org’s Survival Guide

      July 22, 2025

      Execute Ping Commands and Get Back Structured Data in PHP

      July 22, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025
      Recent

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025

      “I don’t think I changed his mind” — NVIDIA CEO comments on H20 AI GPU sales resuming in China following a meeting with President Trump

      July 22, 2025

      Galaxy Z Fold 7 review: Six years later — Samsung finally cracks the foldable code

      July 22, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Helpful Git Aliases To Maximize Developer Productivity

    Helpful Git Aliases To Maximize Developer Productivity

    May 14, 2025
    Git is a powerful tool, but it can sometimes be overwhelming with the number of commands required to perform common tasks. If you’ve ever found yourself typing out long, complex Git commands and wondered if there’s a faster way to get things done, you’re not alone. One way to streamline your workflow and reduce repetitive typing is by using Git aliases. These are shorthand commands that allow you to perform lengthy Git operations with just a few characters.
     
    In this post, we’ll explore some useful Git aliases that can help you maximize your productivity, speed up common workflows, and maintain a clean Git history.

    How To Add Aliases To Your Git Config File

    To start using Git aliases, you need to add them to your .gitconfig file. This file is typically located in your home directory, and it contains various configurations for your Git setup, including user details and aliases.
     
    Here’s how to add aliases:
      1. Open the .gitconfig file:
        • On Linux/MacOS, the .gitconfig file is typically located in your home directory (~/.gitconfig).
        • On Windows, it is located at C:Users<YourUsername>.gitconfig.
      2. Edit the .gitconfig file: You can manually add aliases to the [alias] section. If this section doesn’t already exist, simply add it at the top or bottom of the file. Below is an example of how your .gitconfig file should look once you add the aliases that we will cover in this post:
        [alias]
          # --- Branching ---
          co = checkout
          cob = checkout -b
          br = branch
        
          # --- Working Directory Status ---
          st = status
          df = diff
        
          # --- Commit & Push ---
          amod = "!f() { git add -u && git commit -m "$1" && git push; }; f"
          acp = "!f() { git add -A && git commit -m "$1" && git push; }; f"
        
          # --- Stash ---
          ss = stash
          ssd = stash drop
        
          # --- Reset / Cleanup ---
          nuke = reset --hard
          resetremote = !git reset --hard origin/main
        
          # --- Rebase Helpers ---
          rbc = rebase --continue
          rba = rebase --abort
          rbi = rebase -i
        
          # --- Log / History ---
          hist = log --oneline --graph --decorate --all
          ln = log --name-status
        
          # --- Fetch & Sync ---
          fetch = fetch --all --prune
          pullr = pull --rebase
          up = !git fetch --prune && git rebase origin/$(git rev-parse --abbrev-ref HEAD)
          cp = cherry-pick
      3. Save and close the file: Once you’ve added your aliases, save the file, and your new aliases will be available the next time you run Git commands in your terminal.
      4. Test the aliases: After saving your .gitconfig file, you can use your new aliases immediately. For example, try using git co to switch branches or git amod "your commit message" to commit your changes.

    Explanation of the Aliases

    I find these to be very helpful in my day-to-day work as a web developer. Here are some explanations of the aliases that I have added:

    Branching

    co = checkout

    When switching between branches, this alias saves you from typing git checkout <branch_name>. With co, switching is as simple as:
    git co <branch_name>
     

    cob = checkout -b

    Creating and switching to a new branch is easier with this alias. Instead of git checkout -b <new_branch_name>, simply use: 
    git cob <new_branch_name>
     

    br = branch

    If you need to quickly list all branches, whether local or remote, this alias is a fast way to do so:
    git br
     

    Working Directory Status

    st = status

    One of the most frequently used commands in Git, git status shows the current state of your working directory. By aliasing it as st, you save time while checking what’s been staged or modified:
    git st
     

    df = diff

    If you want to view the changes you’ve made compared to the last commit, use df for a quick comparison:
    git df
     

    Commit and Push

    amod = “!f() { git add -u && git commit -m ”$1” && git push; }; f”

    For quick commits, this alias allows you to add modified and deleted files (but not new untracked files), commit, and push all in one command! It’s perfect for when you want to keep things simple and focus on committing changes:
    git amod "Your commit message"
     

    acp = “!f() { git add -A && git commit -m ”$1” && git push; }; f”

    Similar to amod, but this version adds all changes, including untracked files, commits them, and pushes to the remote. It’s ideal when you’re working with a full set of changes:
    git acp "Your commit message"
     

    Stash

    ss = stash

    When you’re in the middle of something but need to quickly save your uncommitted changes to come back to later, git stash comes to the rescue. With this alias, you can stash your changes with ease:
    git ss
     

    ssd = stash drop

    Sometimes, after stashing, you may want to drop the stashed changes. With ssd, you can easily discard a stash:
    git ssd
     

    Reset / Cleanup

    nuke = reset –hard

    This alias will discard all local changes and reset your working directory to the last commit. It’s especially helpful when you want to start fresh or undo your recent changes:
    git nuke
     

    resetremote = !git reset –hard origin/main

    When your local branch has diverged from the remote and you want to match it exactly, this alias will discard local changes and reset to the remote branch. It’s a lifesaver when you need to restore your local branch to match the remote:
    git resetremote
     

    Rebase Helpers

    rbc = rebase –continue

    If you’re in the middle of a rebase and have resolved any conflicts, git rebase --continue lets you proceed. The rbc alias lets you continue the rebase without typing the full command: 
    git rbc
     

    rba = rebase –abort

    If something goes wrong during a rebase and you want to abandon the process, git rebase --abort will undo all changes from the rebase. This alias makes it quick and easy to abort a rebase:
    git rba
     

    rbi = rebase -i

    For an interactive rebase, where you can squash or reorder commits, git rebase -i is an essential command. The rbi alias will save you from typing the whole command:
    git rbi
     

    Log / History

    hist = log –oneline –graph –decorate –all

    For a good-looking, concise view of your commit history, this alias combines the best of git log. It shows commits in a graph format, with decoration to show branch names and tags, all while keeping the output short:
    git hist
     

    ln = log –name-status

    When you need to see what files were changed in each commit (with their status: added, modified, deleted), git log --name-status is invaluable. The ln alias helps you inspect commit changes more easily:
    git ln
     

    Fetch and Sync

    fetch = fetch –all –prune

    Fetching updates from all remotes and cleaning up any deleted branches with git fetch --all --prune is essential for keeping your remotes organized. The fetch alias makes this task a single command:
    git fetch
     

    pullr = pull –rebase

    When removing changes from the remote, rebase are often better than merges. This keeps your history linear and avoids unnecessary merge commits. The pullr alias performs a pull with a rebase:
    git pullr

    up = !git fetch –prune && git rebase origin/$(git rev-parse –abbrev-ref HEAD)

    This alias is a great shortcut if you want to quickly rebase your current branch onto its remote counterpart. It first fetches the latest updates from the remote and prunes any deleted remote-tracking branches, ensuring your local references are clean and up to date. Then it rebases your branch onto the corresponding remote, keeping your history in sync:
    git up
     

    cp = cherry-pick

    Cherry-picking allows you to apply a specific commit from another branch to your current branch. This alias makes it easier to run:
    git cp <commit-hash>

    Final Thoughts

    By setting up these Git aliases, you can reduce repetitive typing, speed up your development process, and make your Git usage more efficient. Once you’ve incorporated a few into your routine, they become second nature. Don’t hesitate to experiment and add your own based on the commands you use most. Put these in your .gitconfig file today and start enjoying the benefits of a more productive workflow!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleUnlock Automation Success: Power Automate Workshops at TechCon365 PWRCON
    Next Article 5 Questions to ask CCaaS Vendors as you Plan Your Cloud Migration

    Related Posts

    Development

    GPT-5 is Coming: Revolutionizing Software Testing

    July 22, 2025
    Development

    Win the Accessibility Game: Combining AI with Human Judgment

    July 22, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    CVE-2023-53140 – “Linux Kernel SCSI Core /proc/scsi Directory Removal Vulnerability”

    Common Vulnerabilities and Exposures (CVEs)

    Your Android phone just got a major Gemini upgrade for music fans – and it’s free

    News & Updates

    Anthropic’s MCP Server Vulnerability Allowed Attackers to Escape Sandbox and Execute Code

    Security

    CVE-2025-45475 – Maccms SSRF Vulnerability in Friend Link Management

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    CVE-2025-7323 – IrfanView CADImage Plugin DWG File Parsing Memory

    July 21, 2025

    CVE ID : CVE-2025-7323

    Published : July 21, 2025, 8:15 p.m. | 4 hours, 25 minutes ago

    Description : IrfanView CADImage Plugin DWG File Parsing Memory Corruption Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of IrfanView CADImage Plugin. User interaction is required to exploit this vulnerability in that the target must visit a malicious page or open a malicious file.

    The specific flaw exists within the parsing of DWG files. The issue results from the lack of proper validation of user-supplied data, which can result in a memory corruption condition. An attacker can leverage this vulnerability to execute code in the context of the current process. Was ZDI-CAN-26428.

    Severity: 7.8 | HIGH

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    This Call of Duty game just hit Xbox Game Pass, but it’s infested with RCE hackers — I’d take cover and avoid playing until there’s a fix

    July 3, 2025

    Ingest CSV data to Amazon DynamoDB using AWS Lambda

    May 13, 2025

    Gears of War: E-Day is coming in 2026, as Phil Spencer shares an update during Xbox Games Showcase 2025

    June 10, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.