- Download & Install git first
git config —global user.email "<your git email>"git config —global user.name "<your git username OR name>"
- Create new repository on your github profile from here
- Go to your projects root folder and open
cmdin windows orterminalon mac and run below commands step-by-step git initgit add .git commit -m "😉 initial commit"- Now copy your github repository url from your newly created repository and paste it in below command
git remote add origin <GIT_REPOSITORY_URL>git remote -vto check your remote url added successfully or notgit branchto view your current branch(master) namegit push -u origin masterpush code on github servergit pulltake pull of code from remote (github server) (for later use)
git branchlist out all current branched for your it maybe master for first timegit branch <NEW_BRANCH_NAME>create new branchgit checkout <NEW_BRANCH_NAME>to change your working branch and go to newly created branch- After doing your changes in code run below commands
git add .git commit -m "modified code"git push -u origin <NEW_BRANCH_NAME>
- Go to another branch from branch that you want to delete
git checkout mastergit branch -d <NEW_BRANCH_NAME>delete branch from local machinegit push origin --delete <NEW_BRANCH_NAME>delete branch from remote
git reset HEAD~[All the changes will remain same]
git checkout mastergit merge devmerge dev branch into master branch