DEV Community

Cover image for Common Git Commands and what they do
Odipo Otieno (KwargDevs)
Odipo Otieno (KwargDevs)

Posted on

Common Git Commands and what they do

  1. git init: Initializes a new Git repository.
  2. git clone: Creates a copy of a remote repository on your local machine.
  3. git add: Adds changes to the staging area, in preparation for a commit.
  4. git commit: Creates a new commit with the changes in the staging area.
  5. git status: Shows the status of the working directory, including changes that have been made but not yet committed.
  6. git log: Shows a log of all commits in the repository.
  7. git diff: Shows the differences between the working directory and the last commit.
  8. git branch: Shows a list of branches in the repository and indicates the current branch.
  9. git checkout: Allows you to switch between branches or restore files in your working directory to a specific commit.
  10. git merge: Merges changes from one branch into another.
  11. git pull: Fetches and merges changes from a remote repository into your local repository.
  12. git push: Pushes commits from your local repository to a remote repository.

Top comments (0)