All You Need To Know About Git And GitHub...

Git

A version Control system.

Commands::

#Initialize Commands :

git init :- Initialize The git repo .
git status :- Tell about status .

#Commit Commands :

git add . :- add all .
git commit -m " " :- commit the repo.
git log :- log all the commits .
git checkout <commit Id> :- go to that commit . (AGR TEKO LAST COMMIT MEIN
 KUCH ADD KIA H TO PHELE USSE NEW BRANHC BNALE KUKI AGR TU AB MASTER
 MEIN JAYEGA TO YE DELETE HO JAYEGI)

git checkout -- .  :- go to last commit .
git reset --hard <commit Id>  :- delete that commit and also which commit occur after it



#  Branches Commands :-

git branch :- tell about branch .
git checkout <branch_name> :- go to that branch .
git checkout -b <branch_name> :- make new branch .
git checkout -b <branch_name> <commitid>:-make that commit a new branch. (or
 agr sirf ik baar code dekhan h mtlb kuch add ni krna to git checkout <commit id>
or agr isme edit krna h to pehle branhc bnalo)
git merge <branch_name> :- merge that branch into current branch .
git branch -D <branch_name> :- delete that branch usually after merge we use it .
git switch <branch_name> :- switch to branch name.

Git Stash :- Without Commit We can save our code (like draft version ).

In Hindi :-
maanle tu code likh rha h or na teko commit krna kuki dirty commit ka kya fayda or 
vapis vala code dekhna h yaa is code ko save krke kuch change or krke dekhne h to 
stash will used.
git stash :- Save work flow but do not quit .
git stash list : show list of stash
git stash apply : recent stash apply .
git stash apply <stashindex> : go to that stash .
git stash push -m ' ' :-  like commit name this is stash name
git stash drop  <stashindex> :- this will delete that stash .
git stash pop <stashindex> :- pop that stash and view that .

Git stash mein agr main stash krta hu or branhc change krke vapis kholta hu to vo purane commit se aayegi stash ko lasne k liye git stash apply yaa git stash pop kr stash pop ka fayda h view k sath sath satsh delete bhi kr deta h . main bat ye h ki branhc change krne k baad last commit dikhta h

Github

git remote add origin <url> :- connect repo to online  .
git remote -v : show all connected remote repo.
git clone <url>: clone it .
git push -u origin :- push it to remote repo.
git remote rm origin: remove connection b/w local and remote repo.
git branch -M " " :-branch name in remote repo.
git push <remote repo name> <remote repo branch> :-push it to remote repo. and at that branch
git pull :- fethc data from online repo
git pull <remote name> <branch name> :-fetch data from specific branch and online repo

RemoteBranching:: In hindi agr github mein branhcing krni mtlb online repo mein to git branch -M krte h krte h or agr hmm kisi bhi branhc mein ho code push krte h hmsesha master branch hi jati h or dusri branch ko krne k liye hmm us branch mein jakr git branch _M

dalte h phir phit git push origin . branhc ban jayegi . ik local folder ki ik se jyada online repo kr sakte h ... bss git remote add

git debugging :-

git log > commit.txt :-(commits.txt mein log store kr dega )
git log --raw | grep -B 10 "fileName"  > commits.txt :- (ye voh commit dega jisne is file ko change kia h )
git diff <commit_id> :- yeh us id k diff btayega

Not So Useful As A Web Developer But Its Fun.