- 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
cmd
in windows orterminal
on mac and run below commands step-by-step git init
git 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 -v
to check your remote url added successfully or notgit branch
to view your current branch(master) namegit push -u origin master
push code on github servergit pull
take pull of code from remote (github server) (for later use)
git branch
list 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 master
git 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 master
git merge dev
merge dev branch into master branch