DEV Community

Amburi Roy
Amburi Roy

Posted on

Most commonly used Git command shortcuts

I often rely on a set of Git command shortcuts that are widely used and find them quite convenient. Admittedly, it took me some time initially to become accustomed to them.

List of shortcuts:

  1. alias g='git' — Simplifies the Git command as 'g'.
  2. alias gs='git status' — Quickly check the current Git repository status.
  3. alias ga='git add' — Prepares changes for the next commit.
  4. alias gaa='git add .' — Adds all changes in the working directory to the staging area.
  5. alias gc='git commit -m' — Commits changes with a specified commit message.
  6. alias gca='git commit -am' — Adds and commits all changes in one step with a commit message.
  7. alias gco='git checkout' — Switches to a different branch or commit.
  8. alias gcb='git checkout -b' — Creates and switches to a new branch.
  9. alias gbd='git branch -d' — Deletes a specified branch.
  10. alias gba='git branch -a' — Lists all branches, including remote branches.
  11. alias gbr='git branch' — Lists local branches.
  12. alias gpl='git pull' — Fetches changes from a remote repository and merges them into the current branch.
  13. alias gph='git push' — Pushes changes to the remote repository.
  14. alias gpho='git push origin' — Pushes changes to the 'origin' remote repository.
  15. alias gl='git log --oneline' — Displays a simplified log of commits.
  16. alias gla='git log --oneline --decorate --graph --all' — Displays a detailed and graphical log of all commits.

Top comments (0)