Top 8 Most Common Git Commands Every Developer Should Know
Config global the email, author name
git config --global user.name "Sam Smith"
git config --global user.email sam@example.com
Git Clone
git clone <repository url>
Git Pull
Fetch latest all changes from the remote and merge any change from the remote to your local branch
git pull
Git Checkout
- Switch to another branch
git checkout <branch name>
- Create new branch
git checkout -b <branch name>
Git Commit
git commit -m "<commit message>"
Git Add
Stage the changes files
Some specific file
git add <file path>
All Files
git add .
Git Push
- If your branch already exists on the remote
git push
- If your branch is only local and does not exist on remote
git push --set-upstream <remote branch> <branch name>
Git Branch
- Create new branch
git branch <new branch>
- Delete branch
git branch -d <branch name>
Post a Comment
Thank for leaving message