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)