{"id":25442096,"url":"https://github.com/techcell-project/.git-docs","last_synced_at":"2025-11-01T14:30:25.407Z","repository":{"id":238349905,"uuid":"649786936","full_name":"TechCell-Project/.git-docs","owner":"TechCell-Project","description":"Step to step to work with git","archived":false,"fork":false,"pushed_at":"2023-06-13T11:21:30.000Z","size":151,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-05-05T19:38:05.472Z","etag":null,"topics":["documentation","markdown"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TechCell-Project.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-05T16:24:01.000Z","updated_at":"2024-05-05T19:38:09.713Z","dependencies_parsed_at":"2024-05-05T19:48:52.256Z","dependency_job_id":null,"html_url":"https://github.com/TechCell-Project/.git-docs","commit_stats":null,"previous_names":["techcell-project/.git-docs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TechCell-Project%2F.git-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TechCell-Project%2F.git-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TechCell-Project%2F.git-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TechCell-Project%2F.git-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TechCell-Project","download_url":"https://codeload.github.com/TechCell-Project/.git-docs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239293928,"owners_count":19615043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["documentation","markdown"],"created_at":"2025-02-17T13:16:50.146Z","updated_at":"2025-11-01T14:30:25.375Z","avatar_url":"https://github.com/TechCell-Project.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Github documentations for project\n\nStep to step to work with git 🔥:\n\n## 🚀 Lưu ý:\n\n- Không làm việc tại các branch main, stable, development. Hãy tạo branch mới, làm việc tại đó.\n- Cách đặt tên cho branch mới:\n  - Theo định dạng `\u003ctype\u003e_\u003cname\u003e`.\n  - Với type là:\n    - Feature: Chức năng mới.\n    - Fix: Sửa lỗi.\n    - Refactor: Sửa lại định dạng, tổ chức lại code.\n    - Test: Kiểm, thử ...\n    - ...\n  - Và `name` là mô tả ngắn gọn cho mục tiêu\n  - (Ví dụ: `Feature_Auth_with_github` để thêm chức năng đăng nhập với github)\n- Thường xuyên [git pull](#1-lấy-code-từ-github) để cập nhât phiên bản mới nhất của code trên github. Đặc biệt trước mỗi khi làm việc và push code hãy chạy [git pull](#1-lấy-code-từ-github)\n- Xử lí [xung đột (conflict)](https://viblo.asia/p/lam-the-nao-de-han-che-conflict-khi-lam-viec-voi-git-djeZ1m8oZWz) sớm nhất có thể khi phát hiện\n\n## 🚀 Step to works:\n\n- Nếu **chưa** có repo, [clone repo](#1-lấy-code-từ-github) từ github\n- [Đã có repo, xác định điều cần làm (feature, fix, ...)](#🚀-lưu-ý)\n- **Không** sử dụng các branch `main`, `stable`, `development` để chỉnh sửa, hãy [tạo branch mới](#2-làm-việc-với-branch) và làm việc trên branch mới đó\n- Kiểm thử\n- [Commit](#3-commit) khi hoàn thành, và [push](#4-push) lên github\n- Tạo **[Pull Request](#5-tạo-pull-request)** và nhờ người khác review code, đánh giá, kiểm thử.\n- Chỉ tạo **[Pull Request](#5-tạo-pull-request)** để merge vào branch `development` hoặc branch khác mà không phải branch `main`, `stable`\n\n# 🔥 Bắt đầu nhanh\n\n### **1. Lấy code từ github:**\n\n- Trường họp chưa có code trên máy:\n  - Clone git repository về máy bằng câu lệnh:\n  ```bash\n  git clone \u003clink-to-repo\u003e\n  ```\n  - Có thể đặt lại tên bằng cách thêm tên phía sau:\n  ```bash\n  git clone \u003clink-to-repo\u003e \u003cname\u003e\n  ```\n- Đã có code trên máy:\n  - Lấy code mới nhất trên github về:\n  ```bash\n  git pull\n  ```\n\n### **2. Làm việc với branch:**\n\n- Kiểm tra branch:\n\n```bash\ngit branch\n```\n\n  \u003cp align=\"center\"\u003e\u003cimg src=\"./images/git-branch.PNG\" alt=\"description of image\" width=\"380px\"\u003e\u003c/p\u003e\n\n- Kiểm tra tất cả các branch:\n```bash\ngit branch --all\n```\n\n- Tạo branch mới:\n```bash\ngit branch \u003cnew_branch_name\u003e\n```\n\n- Chuyển sang branch đã tồn tại:\n\n```bash\ngit checkout \u003cbranch_name\u003e\n```\n\n- Chuyển sang branch chưa tồn tại, và tự động tạo mới:\n```bash\ngit checkout -b \u003cnew_branch_name\u003e\n```\n\n  \u003cp align=\"center\"\u003e\n    \u003cimg src=\"./images/checkout-b.PNG\" alt=\"description of image\" width=\"420px\"\u003e\n  \u003c/p\u003e\n- Để xóa branch, cần phải checkout sang branch khác branch cần xóa sau đó:\n\n```bash\n# nếu branch đã merge vào branch nào đấy rồi\ngit branch -d \u003cbranch_name_to_remove\u003e\n\n# nếu branch chưa từng merge vào branch nào\ngit branch -D \u003cbranch_name_to_remove\u003e\n```\n- Lần đầu clone code có thể sẽ thiếu các branch phụ, mà chỉ có branch chính, như sau:\n  \u003cp align=\"center\"\u003e\n    \u003cimg src=\"./images/first-clone.png\" alt=\"description of image\" width=\"420px\"\u003e\n  \u003c/p\u003e\n\n- Cách xử lí, ví dụ muốn vào branch tên là `development`:\n```bash\ngit switch \u003cbranch_to_switch\u003e\n\n# ví dụ\ngit switch development\n```\n\n### **3. Commit:**\n\n- Để thêm các file muốn commit vào staged area. Bạn cũng có thể sử dụng git add . để thêm tất cả các thay đổi trong repository.\n\n```bash\n  git add \u003cpath-to-file\u003e\n  #or\n  git add .\n```\n\n- Để kiểm tra trạng thái của staged area và các file trong working directory, sử dụng:\n\n```bash\ngit status\n```\n\n- Để xem sự khác biệt giữa các file trong working directory và staged area, sử dụng:\n\n```bash\ngit diff\n```\n\n- Khi đã staged các file, để commit các file (Lưu ý rằng commit message cần phải rõ ràng và mô tả đầy đủ các thay đổi trong commit), sử dụng:\n\n```bash\ngit commit -m \"\u003ccommit_message\u003e\"\n```\n\n- Nếu cần chỉnh sửa lại commit, sử dụng:\n\n```bash\ngit commit --amend\n```\n\n- Để xem lại lịch sử commit của repository, sử dụng:\n\n```bash\ngit log\n```\n\n### **4. Push:**\n\n- Sau khi đã commit các thay đổi, bạn có thể đẩy chúng lên repository trên server bằng lệnh:\n\n```bash\ngit push\n```\n\n- Lưu ý rằng trước khi push, bạn cần phải pull dữ liệu mới nhất từ server về bằng lệnh:\n\n```bash\ngit pull\n```\n\n- Để đẩy các thay đổi lên branch hiện tại, sử dụng lệnh:\n\n```bash\ngit push origin \u003cbranch_name\u003e\n```\n\n- Nếu branch chưa được đẩy lên server trước đó, để đẩy branch và thiết lập upstream cho lần đẩy tiếp theo bạn có thể sử dụng lệnh:\n\n```bash\ngit push --set-upstream origin \u003cbranch_name\u003e\n```\n\n### **5. Tạo pull request:**\n\n- Sau khi push thành công, truy cập vào repo trên github:\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./images/new-branch.PNG\" alt=\"description of image\" width=\"500px\"\u003e\u003c/p\u003e\n- Branch mới đã được push lên thành công, bấm vào branch vừa push, và chọn `Open Pull Request`:\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./images/open-pull-request.PNG\" alt=\"description of image\" width=\"500px\"\u003e\u003c/p\u003e\n- Chuyển sang `development`, không được merge vào `main` trừ khi là hot fix:\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./images/change-to-dev-branch.PNG\" alt=\"description of image\" width=\"500px\"\u003e\u003c/p\u003e\n- Điền tiltle và comment để mô tả mục đích của branch muốn merger, sau đó chọn `Create Pull Request`:\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./images/create-pull-request.PNG\" alt=\"description of image\" width=\"500px\"\u003e\u003c/p\u003e\n\n### **6. Theo dõi Pull Request:**\n\n- Nhớ theo dõi Pull Request để thảo luận về code của bạn ... 🔥\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechcell-project%2F.git-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechcell-project%2F.git-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechcell-project%2F.git-docs/lists"}