Practicing Git commands Here.
git config --global user.name "username_here"
git config --global user.email "useremail_here"
git clone "link goes here"
git status
==>4 types of result
==>untracked->new files that git doesn't know
==>modified->changed
==>staged->file is ready to be committed(only we have added not committed)
==>unmodified->unchanged(committed)
add==>adds new or changed files in your working directory to the Git staging area.
git add <-file name->
git add .(to add all changed files)
commit==>is is the record of change
git commit -m "some message"
push==>upload local repo content to remote repo
git push origin main
INIT COMMAND
init - used to create a new repo
git init
git remote add origin <-link->
git remote -v ==> to verify remote
git branch ==> to check branch
git branch -M main ==> (to rename branch)
git push origin main
git push -u origin main ==> -u means we are setting up upstream which tells that each time we push to main branch only .Every time no need to give origin main thereafter.
Workflow
Create repo in Github -> clone it to local system -> change -> add ->commit
Git Branch
git branch (to check branch)
git branch -M main (to rename branch)
git checkout <-branch name-> (to navigate)
git checkout -b <-new branch name-> (to create new branch)
git branch -d <-branch name-> (to delete branch)
MERGING CODE
Way1
git diff <-branch name-> (to compare commits,branches,files & more)
git merge<-branch name-> (to merge 2 branches)
Way2
Create PR (Pull request)-->it tells others about changes you've pushed to a branch in a repository on GitHub.