DEV Community

Rishabh Rathore
Rishabh Rathore

Posted on

Here are some Git commands that can help you to save time and increase your productivity

If you don't know about it, here is a short description of git🤔 :

Git is a popular open-source distributed version control system that allows for efficient collaboration among developers and easy switching between different project versions. It can handle projects of any size with speed and efficiency and provides powerful features for tracking changes and analyzing project history.

  1. Git init: Create an empty Git repository or reinitialize an existing one

  2. Git Diff: Recognize changes between commits, commit and working tree, etc.

  3. Git Status: List the new or unmodified file

  4. Git add : Stage a file

  5. Git add . / add * / --all: Stage all changed files at once

  6. Git commit -a: Commit all local changes in tracked files

  7. Git commit: Commit previously staged changes

  8. Git commit --amend: Change the last commit

  9. Git-log: Show commit logs

  10. Git log --oneline: Display the log in a single line for quick reference

  11. Git log --grep =" ": Limit the output to commits with log messages that match a pattern (regular expression)

  12. Git checkout : Switch to a new branch and update the working directory

  13. Git branch -d/--delete: Delete a branch

  14. Git checkout -b - : Create and switch to a new branch

  15. Git-revert: Revert existing commits

  16. Git-reset: Reset the current HEAD to a specified state

  17. Git fetch : Fetch all branches from a remote repository

  18. Git pull : Fetch remote version of a branch and update the local branch

  19. Git push : Push committed changes to a remote repository

  20. Git merge : Merge the specified branch into the current branch

Use these Git commands to streamline your workflow and improve your coding experience.

Top comments (0)