✅ Git là gì? (Git CSM)
✅ Ưu điểm của Git
✅ Dịch vụ Git (GitHub)
✅ Các bước cài đặt để sử dụng được Git trên Windows
✅ Cách đẩy source code lên GitHub với Tortoisegit
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Định nghĩa ở trên mình lấy ở trang git-scm.com. Hiểu nôm na Git là một phần mềm quản lý mã nguồn (source code) phân tán.
Note: Các bạn mới cần phân biệt giữa git và git server.
Ví dụ: GitHub là một git server. Bạn có thể tạo một respository trên github. Repository trên git server này gọi là remote repository. Bạn có thể Clone Remote Repository về máy bạn thành Local Repository
Repostiory được hiểu như là một nơi lưu trữ chứa mã nguồn (source code) và tất cả thông tin liên quan đến việc sửa đổi và lịch sử của toàn bộ project (dự án).
Dữ liệu của repository git có thể xem ở folder .git:
Respository có 2 loại:
Ví dụ:
Khi ta làm một tính năng (feature) mới ta có thể tạo ra một branch riêng để code cho feature này. Sau khi feature hoàn thành ta có thể merge code vào branch chính (master).
Hoặc trong team có nhiều team members ta có thể chia repository thành nhiều branch. Với mỗi branch cho một người. Việc chia thành các branch riêng biệt rất tiện lợi cho việc làm việc theo nhóm và tách biệt source code, cùng lúc chỉnh sửa trên 1 repository.
Có 2 loại branch. Tương tự như repository, branch cũng có 2 loại:
An sẽ chỉ các bạn trên GitHub. Còn GitLab tương tự vậy luôn.
gitignore là file có tên là .gitignore do Git quy định. Nhiệm vụ của nó là liệt kê những file mà mình không mong muốn cho vào git hoặc hiểu nôm na là Git sẽ bỏ qua những file đó đi không mang lên dịch vụ lưu trữ source code. gitignore hiện nay rất quan trọng trong team work, các bạn nên áp dụng ngay vào quy trình làm việc của team cụ thể là source code automation test dành cho Tester chúng ta.
Có thể hiểu đơn giản là git sẽ bỏ qua file hoặc một tập các file trong project của chúng ta khi commit và push lên repository. Ví dụ:
Git quản lý các file mà chúng ta muốn “ignore” bằng file .gitignore
được đặt ở trong thư mục root project.
Khi add 1 file mới vào git, git sẽ kiểm tra danh sách những file sẽ bỏ qua trong file .gitignore và không add chúng vào git. Đó mới chỉ là điều kiện cần, điều kiện đủ là files không có trong git cache nữa thì git nó mới bỏ qua, chứ files mà nằm trong git cache thì .gitignore sẽ vô tác dụng.
🔆 File .gitignore
bin/
out/
.idea/
.allure/
allure-results/
ExportData/
ExtentReports/
logs/
target/
test-output/
reports/
*.png
*.jpg
*.mp4
*.avi
*.zip
*.iml
Lưu ý: khi mà file hoặc folder đã lên trên server trước khi chúng ta add nó vào gitignore thì nó sẽ KHÔNG BỊ DELETE ĐƯỢC. Muốn DELETE ĐƯỢC chúng ta cần phải delete nó dưới local xong commit push lên lại thì từ đó về sau nó mới hiểu loại bỏ như trong gitignore.
Trước khi mở code làm việc thì chúng ta nên làm theo các bước sau:
Severity: Notice
Message: Undefined variable: new
Filename: post/post_detail.php
Line Number: 384
Backtrace:
File: /home/anhtest2/public_html/application/views/frontend/post/post_detail.php
Line: 384
Function: _error_handler
File: /home/anhtest2/public_html/application/views/frontend/layout/layout_view.php
Line: 370
Function: view
File: /home/anhtest2/public_html/application/core/MY_Controller.php
Line: 34
Function: view
File: /home/anhtest2/public_html/application/controllers/frontend/Post.php
Line: 59
Function: render
File: /home/anhtest2/public_html/index.php
Line: 315
Function: require_once
Severity: Notice
Message: Trying to get property 'slug' of non-object
Filename: post/post_detail.php
Line Number: 384
Backtrace:
File: /home/anhtest2/public_html/application/views/frontend/post/post_detail.php
Line: 384
Function: _error_handler
File: /home/anhtest2/public_html/application/views/frontend/layout/layout_view.php
Line: 370
Function: view
File: /home/anhtest2/public_html/application/core/MY_Controller.php
Line: 34
Function: view
File: /home/anhtest2/public_html/application/controllers/frontend/Post.php
Line: 59
Function: render
File: /home/anhtest2/public_html/index.php
Line: 315
Function: require_once
Anh Tester
Đường dẫu khó chân vẫn cần bước đi
Đời dẫu khổ tâm vẫn cần nghĩ thấu