Notes sử dụng GIT (github)
Cấu hình
Khai báo cấu hình git trên máy tính
Mở git bash
ra và lần lượt chạy các lệnh sau:
Nhớ thay {your_name} và {your_email} tương ứng với thông tin account github của bạn.
git config --global user.name {your_name}
git config --global user.email {your_email}
ssh-keygen -t rsa
ls ~/.ssh/
ssh-agent -s
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
Tạo SH Key cho github
Truy cập https://github.com/settings/keys Tạo một key mới
paste
key copy ở bước cuối phần config trên vào và lưu lại.
Giải quyết một số lỗi hay gặp
fatal: refusing to merge unrelated histories
git pull origin branchname --allow-unrelated-histories
https://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories-on-rebase
Tìm tên, đường dẫn của reposite mình đang có ở local
git config --get remote.origin.url
Git - Cloning Specific Commits
https://github.com/<repo_name>/tree/<commit_sha>
https://github.com/soiqualang/thongke_phanloai_raster/commit/1a222352b31fcdfc31e0ab7a325cf27b3dfdf2ac
https://github.com/soiqualang/thongke_phanloai_raster/tree/1a222352b31fcdfc31e0ab7a325cf27b3dfdf2ac
Clone The Repo And Checkout The Specific Commit
git clone -n <repo_name>
git checkout <commit_sha>
Clone The Repo And Checkout The Specific Commit Into A Branch
git clone -n <repo_name>
git checkout -b <new_branch> <commit_sha>
https://coderwall.com/p/xyuoza/git-cloning-specific-commits
How to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
https://gist.github.com/mobilemind/7883996
soiqualang_chentreu