Git is a powerful distributed version control system that allows developers to collaborate and manage source code efficiently. Here’s a list of some of the most commonly used Git commands with a brief explanation:
git init: Initializes a new Git repository in the current directory.
git clone: Copies a repository from a remote source to your local machine.
git add: Adds a file to the staging area. Changes to files in the staging area will be included in the next commit.
git commit: Saves changes made to the files in the staging area to the local repository.
git push: Pushes changes made to the local repository to the remote repository.
git pull: Pulls changes made to the remote repository to the local repository.
git merge: Combines two or more branches in the repository.
git branch: Creates a new branch in the repository.
git checkout: Switches to a different branch in the repository.
git status: Displays the current status of the repository, including which files have been modified and which files are in the staging area.
git log: Displays a history of all commits made to the repository.
git diff: Shows the differences between two commits or between the working directory and the repository.
git stash: Temporarily saves changes that are not yet ready to be committed.
git remote: Shows a list of remote repositories and their URLs.
git tag: Creates a new tag at the current commit.
git reset: Unstages changes in the staging area or resets the repository to a previous commit.
git revert: Creates a new commit that undoes the changes made in a previous commit.
git fetch: Fetches changes from a remote repository, but does not merge them.
git cherry-pick: Applies the changes made in a specific commit to the current branch.
git submodule: Manages submodules, which are repositories within repositories.
These are just a few of the many Git commands available. For more information, you can use the
git help command or consult the official Git documentation.