Suhail Kakar
Suhail Kakar

@SuhailKakar

7 Tweets Jan 12, 2023
Ready to take your Git skills to the next level?
Check out our handy list of 25 Git commands and explanations. ↓
1/
- git init: It is used for initializing a Git repository
- git clone URL: Used to clone the repository from remote
- git add [file-name]: Add a file in to the staging
- git add . : Add all files in the staging
- git add -A: Add new files to the staging
2/
- git commit -m "message": Commit the changes
- git rm -r file.html: Removes a file
- git branch: lists are the branches
- git status: Checking the status
- git branch -a: List all the local and remote branches
3/
- git config --global --list: Get global config
- git revert commit_id: Revert the changes for a commit using id
- git log: View the changes
- git pull: Pull the changes from remote to local
- git push: Push the changes from local to remote
4/
- git branch branch_name: Create a new branch
- git branch -d branch_name: Delete a branch
- git checkout branch_name: Switch to a branch
- git checkout -- file.html: Discard changes from a file
- git stash: Stash the changes
5/
- git stash clear: Discard all the stashes
- git remote add origin URL: Add a remote repository
- git branch -m old_branch_name new_branch_name
- git checkout - : Switch to the branch last checked out
- git log --summary: View changes with details
Here is a bonus cheatsheet that contain all the git commands with plain English explanations

Loading suggestions...