01. create git local repository
$ git init
02. add file to staging area
(1) add a file:
$ git %file name%
(2) add all files:
$ git .
(3) remove all files from staging area
$ git rm --cached -r .
(-r = recursive)
(4) check if file is added:
$ git status
03. commit to local repository
(1) make commit:
$ git commit -m %adding message%
(2) check if file is commited:
$ git log
04. call back file from local repository
(1) check what different in two files
$ git diff
(2) change file to the latest version
$ git checkout %file name%
push files from local repository to remote repository
(1) create remote repository
$ git remote add origin(name of remote repository) %url from GitHub%
(2) push file to remote repository
$ git push -u origin(name of remote repository) master(name of branch)
05. clone the file from remote repository to local
$ git clone %HTML url%
06. branching & merging
(1) create a new branch
$ git branch %branch name%
(2) check all branches and where we worked in
$ git branch
(3) switch to the branch
$ git checkout %branch name%
(4) merge sub branch to master branch:
$ git branch master
$ git merge %sub branch name%
07. gitignore
(1) create a hidden file called .gitignore
$ touch .gitignore
$ attrib +h .gitignore
(2) write what you want to ignore in .gitignore
secrets.txt