GitHub Workflow: Setting Users, Branching, and Pushing

GitHub Workflow: Setting Users, Branching, and Pushing

Digging Deep

Difference between Main Branch and Master Branch.

At the time when Git was being developed by Linus Torvalds, in America, there was once a slavery system. Keeping that in mind the developer named their main branch as Master Branch considering others as Slave branches. But as time passed people began to criticise these names and when GitHub came under Microsoft they renamed it Master to Main thus in GitHub, we have a Main branch but as Git is open source the name Master in Git wasn't changed.

Basic commands in Git

#Initializing Git
git init
#Adding a files to staging area
git add <File name># or <Just a '.' for adding the whole repo> the once which are already staged will ne skipped
#checking the status after adding
git status
#Commiting
git commit -m "Message"
#checking log after commiting
git log
#Cloning a repo from GitHub
git clone <repo link>
#Revering or Reseting a Git commit
git reset <commit id>
#if origin is not present one can create it too
git remote add origin <repo link>

Setting user name and email address associated with one's commit

#Setting Name
git config --global user.name "Your Name"
#Setting Email
git config --global user.email "your.email@example.com"

Branching

#creating a branch
git checkout -b <Branch name>
#Switiching a branch
git checkout <branch name>

Pushing to GitHub

git push origin <branch name>
#if you want to change the origin 
git remote set-url --add origin <link>
#deleting a origin url
git remote set-url --delete origin <link>
#checking the origin link
git remote -v