15_git - hpscript/laravel GitHub Wiki
$ git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
$ touch index.html
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
index.html
nothing added to commit but untracked files present (use "git add" to track)
$ git add .
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: index.html
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: index.html
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: index.html
$ git reset --hard 9b04c8fef11de3d26485fed464d3554fe9829975
$ git merge newcategory
Updating 6ac2934..9762c51
Fast-forward
category.php | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 category.php
$ git status
On branch master
nothing to commit, working tree clean
$ git log
commit 9762c51b382bc6b6256c7d6a0a3f676f88b3d1aa (HEAD -> master, newcategory)
Author: hpscript <[email protected]>
Date: Fri Dec 13 07:14:43 2019 +0000
new category
commit 6ac2934b2e8a4952bb603a2ade9b8525f9ed8c26
Author: hpscript <[email protected]>
Date: Fri Dec 13 06:08:23 2019 +0000
initial commit
$ ls
category.php index.html
$ git branch -d newcategory
$ git config --global user.name "${name}"
$ git config --global user.mail "${email}"
- プロジェクト開始時にcommitする
- 機能追加や忘れてたくないコーディングをした時
$ git init
$ git status
$ git add .
$ git commit -m "application to the github"
- プライベートリポジトリ作成 $ git remote add origin https://github.com/${username}/${repositoryName}.git
$ git push -u origin master
Username for 'https://github.com': ${username}
Password for 'https://${username}@github.com'
↓
remote: Invalid username or password.
Github右上のハンバーガーメニュー -> "Settings" -> right menu "Developer Settings" -> Personal access tokens -> generate token
Full control of private repositoriesにチェックを入れて、tokenを発行
発行されたトークンをパスワードに入力すれば、pushできます。
Username for 'https://github.com': ${username}
Password for 'https://${username}@github.com' : ${generated token}