How to Create Repository in GitHub using Git
Git...
GitHub...
1. Create the folder, then put code into it
2. By clicking on
the folder right click and click Git bash here
{ touch index.html creates new
html file in the folder}
3. git init { creates .git folder}
4. git config
--global user.name 'Name'
5. git config --global user.email 'xx@gmail.com'
6.
git add index.html--> git status { shows which files are in staging area and
which are not tracked}
7. git rm --cached index.html { removes index.html from
staging area to untracked files}-->git status
8. git add . { adds all the files
} { now if you make somechanges-->git status it would show modified files-->git
add .}
9. git commit { then remove # before initial commit-->type :WQ at the
bottom}
9. {change anything in the code --> git add .-->git commit -m 'Changed
app.js'}
10. clear {clears the screen}
11. { adding entire directories}
12.
touch .gitignore { created a file in which files which are not be included are
witten e.g log.txt /dir2} 13. git branch login { for working on login without
editing the main branch, then when its done u merge} 14. git checkout login {
Now we are in the login branch--> touch login.html { edit in the
login.html}-->git add .-->git commit -m 'login form'-->git checkout master{
login.html file is gone}-->git merge login{opens up vim}{write Merge branch
'login' Added login click escape :WQ} }
14. git remote
15. git remote add origin
https://github.com/DECODER-NR17/SLASHBILL.git { Not That for the first time use
you should make aleast a commit before doing this or else shows error error: src
refspec master does not match any}
16. git push -u origin master
17. { If you made changes in your local repository then}
i. git add .
ii. git commit -m 'xx'
iii.git push origin master
{ Now the online repository is updated as well}
Comments
Post a Comment