‘Commands to use Github From Terminal / CMD / Poweshell’

— — — — — — — — — — — — — — — — — -
First and foremost setup: {GIT}:
git config — global user.name ‘Your Name’
git config — global user.email ‘Your EMAIL’

Stages in GIT:

Untracked — Area where there is no initailization of git
Unmodified — Ready for Submit
Modified — Stage edited files from Unmodified to stage area
Staged — Ready for commit area , it pass files to Unmodified area

git init #initialize pwd in git

git status #show status of files (brief status)
git status -s #show summarized very short status (veryshort) [use for massive changes with file]

git add index.html #pass file to staging area , ready for commit
git add -A #Pass all files in pwd at once to Staging area

git commit #Commit the changes
git commit -a -m ‘messege’ # To commit all files at once

#When commiting , it open config file to edit about changes: (Uncomment #Initial commit)
#For editing commit , alternative: git commit -m ‘Messege’

git checkout <file> #check current with last commited (for single file)
git checkout -f #Update current file with last commit (for all files in pwd)

git log # tell info about git
git log -p -1 #tell history of (-1 repr no. of) edit and commits

git diff # see what is modified in files
git diff — staged #see diff between modified staged file to last commit

git rm filename #delete file from staging and current folder
git rm — cached filename #remove file from staging area but not curdir
(Can be used to place file untracked area from staged area)

— — — — — —
Git ignores
— — — — — —
Whenever you want to exclude files from pwd from git then it is useful
— -
1.Create .gitignore file
2.open file and add filenames which you want to ignore

/filename.log #only ignore matching file from root dir of .gitignore file
*.log #ignore all path log files
folder/ # forward slash repr ignore folder

— — — -
Branch — Creation of Development environment to Upgrade currnt branch (Just like creating another environment)
— — — -
git branch Branch_name #To add Branch
git branch #list all branch
git checkout Branch_name #Switch to Branch_name from current Branch
git checkout -b Branch_name #Create new branch and switch to it immidiately

git merge Branch_name #After Upgrade , Merge dev_eniron(Branch_name) with current Branch

=============== — -
GiT Remote Repository
— — — — — — — — — — -
git remote -v # list remote repo
git remote add repo_name ssh_URL
>>Configuring SSH

1. Go to settings in Account settings > SSH and GPG keys > Generate New SSH key
ssh-keygen -t **** -C "your_email@example.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_****
cat ~/.ssh/id_***
sudo apt update
sudo apt-get install xclip -y
xclip -selection clipboard < ~/.ssh/id_****.pub #Copy public key using terminal
ssh -T git@github.com #To verify setup

#SSH URL looks like:

#open setting in github and paste publickey into Add_SSH key options

2. Add SSH key in Add new SSH key option in setting :
Give title :
Paste SSH key :

It will give read and write access to your PC .
then you can directly Push Repo

git init
git add README.md
git commit -m "COMMIT MESSEGE"
git branch -M BRANCH_NAME
git remote add PROJECTNAME git@github.com:USERNAME/PROJECTNAME.git
git push -u repo_name branch_name

Example :
└─$ git remote add PROJECTNAME git@github.com:USERNAME/***REPO***.git

└─$ git remote -v
VMB_automation git@github.com:USERNAME/***REPO***.git (fetch)
VMB_automation git@github.com:USERNAME/**REPO****.git (push)

└─$ git remote remove PROJECTNAME

└─$ git push -u PROJECTNAME master
Enumerating objects: 24, done.
Counting objects: 100% (24/24), done.
Delta compression using up to 2 threads
Compressing objects: 100% (21/21), done.
Writing objects: 41% (10/24), 2.53 MiB | 1.24 MiB/s

GEEK, SYSTEM Researcher, Developer and Hacker As well …These are my Identity …