Title Code
1st create a folder for git on pc
Basic configration...

$ git init	create .git file 
$ git --version
$ git config --global "Aslam"
$ git config --global ""
$ git config --list

Each of every project user & email
$ git config "aslam"
$ git config ""

upload file...
$ git status
$ git add file.txt	[save this file]
$ git add --all	 or
$ git add .
$ git commit -m "message"
$ git remote add origin https...
$ git push -u origin master 

download file...
git status
git log
first create a folder...
git clone https link...

git status
git add .
git commit -m "message"
git log
git pull	
git push	[upload to master branch]

log 	[list of commit]
$ git log
$ git log --oneline

download from branch
create a branch first in git hub...

git clone https link...  -b branchName
branchName= about, help, contact etc
switch go any repository or branch
git checkout  a1b2c3

How to switch back to 'master' with git?

git stash or git commit -m "abcd"
git checkout master
git branch -D merchantApi

Note: Above steps will delete the branch locally.

For deleting the branch you have to stash
 the changes made on the branch 
or you need to commit the changes
 you made on the branch. 
Follow the below steps if you made
 any changes in the current branch.
Github delete last commit
2nd commit : 2020
1st commit : 1010
git reset --hard 1010
git push --force
Git check user
Local check
git config
git config
Global check
git config --global
git config --global
Change local
git config "gitHub-UserName"
git config "gitHub-email"
Change global
git config --global "gitHub-UserName"
git config --global "gitHub-email"
git info
github set project url
	->git remote set-url origin [repository link]

github show project url
	->git remote show origin
Rename last commit
git commit --amend -m "New commit message"
git move other commit
git fetch origin [commit no]
git checkout FETCH_HEAD
Undo Git Pull
git reset commitNumber --hard
Git Uncommit
git reset --soft HEAD~1
git project url change
git remote set-url origin
git push -u origin main
git branch
create branch
=> git branch anyName

edit branch
You edit branch which branch you stay
=> git branch -m newName

delete branch
You don't delete this branch which branch you stay now.
=> git branch -d branchName

Switch any branch
=> git checkout branchName

branch status see
=> git branch


[(* icon) means you are now stay main branch]

N:B: You are now [main branch] and you have 3 commit. when you create [dev branch] the main branch's all commit copy from main to dev branch.
So you should work now dev branch and when you have 5 commit you can merger the main branch.

But if you want to dev branch merge, you stay now main branch and pull/copy code from dev branch.

=> git merge dev

git merge: if you are now main branch with no code or commit, but want to merge/copy from another/dev branch.

In locally pc
git merge origin dev --allow-unrelated-histories

from server/cloud
git pull origin masterOrDev --allow-unrelated-histories

N:B: if you want default main branch to dev, it working in the github server. There are many option to rename, default any branch as root/main branch.
How to reset your Git Settings
git config --global --unset
git config --global --unset
git config --global --unset credential.helper
cmdkey /delete:LegacyGeneric:target=git:
git config --global “username”
git config --global emailaddr
git config  credential.helper ‘store’
git remote add origin repolink
git remote -v
git init 
git add .   (Stage)
git commit -m “message”  (Commit)
git push origin master  (Push)
git reset last work and move last commit
git reset --hard