Here's a list of popular Git commands:

				
					git init - Initializes a new Git repository
git clone <repository> - Creates a copy of a remote repository on your local machine
git config --global user.name "<name>" - Sets your global Git username
git config --global user.email "<email>" - Sets your global Git email
git config --list - Lists the current Git configuration
git status - Shows the status of your working directory, including any changes, additions, or deletions
git add <file> - Adds a specific file to the staging area
git add . - Adds all new, modified, or deleted files to the staging area
git commit -m "<message>" - Commits the staged changes with a descriptive message
git log - Shows the commit history
git log --oneline - Shows the commit history in a condensed format
git diff - Shows the differences between the working directory and the latest commit
git diff --staged - Shows the differences between the staging area and the latest commit
git checkout <branch> - Switches to a specified branch or commit
git checkout -b <new-branch> - Creates a new branch and switches to it
git branch - Lists all local branches
git branch -r - Lists all remote branches
git branch -d <branch> - Deletes a specified branch
git merge <branch> - Merges the specified branch into the current branch
git fetch - Retrieves the latest changes from the remote repository, but does not merge them
git pull - Fetches the latest changes from the remote repository and merges them into the current branch
git push - Pushes your local commits to the remote repository
git push -u origin <branch> - Pushes a new branch to the remote repository and sets up tracking
git remote -v - Lists remote repositories connected to your local repository
git remote add <remote-name> <repository-url> - Adds a remote repository to your local repository
git remote remove <remote-name> - Removes a remote repository from your local repository
git stash - Temporarily saves changes in the working directory that are not ready to be committed
git stash list - Lists all stashed changes
git stash apply - Restores the most recently stashed changes
git stash drop - Discards the most recently stashed changes
git stash pop - Restores and removes the most recently stashed changes
git stash branch <branch> - Creates a new branch and applies the stashed changes to it
git blame <file> - Shows who made changes to a file, line by line
git tag - Lists all tags in the repository
git tag <tagname> - Creates a lightweight tag for the current commit
git tag -a <tagname> -m "<message>" - Creates an annotated tag for the current commit
git show <tagname> - Shows the tag information and associated commit
git push origin <tagname> - Pushes a specific tag to the remote repository
git push origin --tags - Pushes all tags to the remote repository
git fetch --tags - Fetches all tags from the remote repository
				
			
Social Share: