-
For initilization a git repo
git init
-
For Cloning an exsisting repo in local
git clone <url>
-
For adding a remote repo
git remote add origin <url>
-
now for selecting file's that you want to keep the track of changing
git add <file name> ## for selecting all files git add .
-
For the commit in the repo
git commit -m " your message"
-
for both at the same time selecting and commit
git commit -am " your message "
-
For pushing code on github repo
git push
-
For puling updated code from the repo
git pull <url>
-
For checking the history of the commits that made
git log
-
For Resting the commit that are made
git reset hard < commit code > ## for code mean when you will run command git log each commit will have a code thats the code you have to insert
-
For Checking status
git status
- For creating a new branch
git branch < neww branch name you want to have>
- for checking the current branch you are on
git branch
- For going into another branch
git checkout <branch name you want to enter>
- for merging code from the new branch to main branch
git merge <branch you want to merge>
- for creating a new branch & moving into that branch
git checkout -b <name>
- Delete a local branch
git branch -d <branch-name>
- Delete a remote branch.
git push origin --delete <branch-name>
- Set your name in Git (global configuration).
git config --global user.name "Your Name"
- Set your email in Git (global configuration).
git config --global user.email "you@example.com"
- Get help for a specific Git command.
git help <command>