Here are some commonly used Git commands for someone who is learning 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.creating and handling the branches in a repository
git branch - Lists all branches in the repository.
git branch - Creates a new branch.
git checkout - Switches to an existing branch.
Top comments (0)