git
tags git
command line
git config --global user.email ""
git config --global user.name ""
git status
git init
git add --all
git commit -m "what do you done"
git branch -M main
git remote add origin https://github.com/lanx06/heroku.git
git push -u origin main
add 儲存 暫存
git add . and git add –all
git add .
只會新增或修改已存在檔案不會刪除
git add –all
所有檔案直接同步 如果有刪除檔案則會直接刪除 github上的版本
push 上傳
強制上傳
git push -f origin main更改上傳位置
git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git確認上傳位置
git remote -v
pull 同步檔案
git pull origin master
Clone or download
git clone https://github.com/lanx06/heroku.git
checkout index
git checkout index.py
checkout commit
git checkout commithash
branch 分支
checkout remote branch
git checkout -b branch_name origin/branch_name分支清單
git branch開啟分支
git branch branch_name合併分支
git merge {new-feature}刪除分支
git branch -d branch_name
其他
初始化專案
git init查看狀態
git status檢查差異
git diff將變更檔案放入暫存區
git add index.py使用 commit -m 提交變更
git -a -m 'init commit'查看歷史
git log --oneline放棄已經 commit 的檔案重回暫存區
git reset HEAD index.py