Frequently used Git commands

Here are some commonly used Git commands for someone who is trying to learn about version control systems. Cloning a Repository git clone – Copies a remote repository to the local machine. Staging Changes git add – Stages a specific file for commit. git add . – Stages all modified and new files. Committing Changes git commit -m "commit message" – Saves the staged changes to the local repository with a message. Pushing Changes to a Remote repository git push – Used for Uploading the committed changes to the remote repository. Restoring Staged changes git restore --staged – Removes a file from the staging area but keeps changes in the working directory. View the Commit history git log – Displays commit history with specific details like author name, date of modification and messages for identification.

Feb 19, 2025 - 18:55
 0
Frequently used Git commands

Here are some commonly used Git commands for someone who is trying to learn about version control systems.

  1. Cloning a Repository
    git clone – Copies a remote repository to the local machine.

  2. Staging Changes
    git add – Stages a specific file for commit.
    git add . – Stages all modified and new files.

  3. Committing Changes
    git commit -m "commit message" – Saves the staged changes to the local repository with a message.

  4. Pushing Changes to a Remote repository
    git push – Used for Uploading the committed changes to the remote repository.

  5. Restoring Staged changes
    git restore --staged – Removes a file from the staging area but keeps changes in the working directory.

  6. View the Commit history
    git log – Displays commit history with specific details like author name, date of modification and messages for identification.