git init - creates a new Git repository
Example: git init
git clone- clones a repository into a new directory
Example: git clone https://github.com/username/repo.git
git add- adds files to the staging area
Example: git add filename
git commit- saves changes to the repository
Example: git commit -m "Add new feature"
git push- sends changes to a remote repository
Example: git push origin master
git pull- retrieves updates from a remote repository
Example: git pull origin master
git status - displays the status of the repository
Example: git status
git log- displays the commit history
Example: git log
git diff- shows differences between the current version and the previous version
Example: git diff
git checkout- switches to a different branch or version
Example: git checkout branch_name
git branch - displays and manages branches
Example: git branch
git merge- merges one branch into another
Example: git merge branch_name
git stash- temporarily saves changes that have not been committed
Example: git stash
git tag - adds a tag to a specific version
Example: git tag v1.0
git blame - shows who made changes to a specific line of code
Example: git blame filename
git revert - undoes changes to a specific commit
Example: git revert commit_hash
git reset- resets the repository to a previous state
Example: git reset --hard HEAD~1
git remote - displays and manages remote repositories
Example: git remote
git fetch - retrieves updates from a remote repository without merging them
Example: git fetch origin
git ls-remote- lists references in a remote repository
Example: git ls-remote origin
git gc - optimizes the Git repository
Example: git gc
git archive- archives the repository into a zip or tar file
Example: git archive --format=zip --output=project.zip HEAD
git show - displays information about a specific commit
Example: git show commit_hash
git describe- shows a concise, human-readable description of a specific version
Example: git describe
git ls-files - lists the files in the repository
Example: git ls-files
git ls-tree - displays the contents of a tree object
Example: git ls-tree HEAD
git fsck- verifies the connectivity and validity of the objects in the repository
Example: git fsck
git filter-branch- modifies the entire Git history of a repository
Example: git filter-branch --tree-filter 'rm -rf directory_name' HEAD
git am- applies a patch to the repository
Example: git am < patch_file.patch
git submodule - manages submodules within a Git repository
Example: git submodule add https://github.com/username/submodule.git
Top comments (0)