How to push your file to git hub?
Mayu Hayakawa
Posted on September 4, 2022
The first way
Commit Local repository to Remote repository
1) Create directory and some files on your computer
1) Create Remote repository on git hub
Push "new button"
set about repository name, Public or Private, if you need add a README file.
Then push Create repository.
Did it!
2) Create Local repository on directory you just made
Command: git init
-git folder(hidden) appear
3) Add file to index
?What is Index?
-Index is an area where changes are temporarily stored before commit, and only files added to the index are subject to commit.
command: git add bun.index(👈file's name)
;If you want to commit all files, command: git add .
4) Commit file to local repository
?What is Commit?
-Commit means the operation of reflecting file additions and changes in the local repository.
Command: git commit -m "some comment"(👈kind of memo)
You can check the change history including commit messages by entering git log command.
Command: git log
When you want quit checking log, please enter "q".
5) Linking local and remote repositories
Command: git remote add origin repository's URL(👈You can copy this from your git hub)
6) Push file to remote repository
?What is Push?
-Push is to reflect changes in a local repository to a remote repository on GitHub.
Command: git push origin branch's name(👈You can check with command: git branch)
The second way
Clone source codes from Remote repository on your Local
1) Clone source codes from Remote repository
2) Make your branch
?What is branch?
3) Commit files to branch you made
4) Push file to remote repository
reference(Japanese)
https://tech-blog.rakus.co.jp/entry/20200529/git
Posted on September 4, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024
November 30, 2024