Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn Git

Mermaid: Minh họa nhánh Git bằng Mermaid.js - Part 2

Giới thiệu Trong quá trình làm việc với Git, đôi khi git log không đủ trực quan để hiểu các nhánh, commit, merge, rebase… Lúc này, Mermaid Git Graph là một công cụ tuyệt vời để vẽ sơ đồ trực quan từ Git history. Mermaid là một công cụ dạng text-based để vẽ sơ đồ như flowchart, Gantt, sequence diagram… và đặc biệt, hỗ trợ cả gitGraph Ví dụ thêm commit vào branch hiện tại gitGraph commit commit commit gitGraph commit commit commit Switch branch và thêm 1 commit gitGraph commit branch develop commit gitGraph commit branch develop commit Ví dụ gitGraph commit id: "Init" branch feature/login checkout feature/login commit id: "Login UI" commit id: "Login Logic" checkout main merge feature/login gitGraph commit id: "Init" branch feature/login checkout feature/login commit id: "Login UI" commit id: "Login Logic" checkout main merge feature/login Chọn theme p...

Một số lệnh trong Git

Một số lệnh thường dùng trong GIT Tạo mới và thêm code  Thêm mới Clone 1 project về: git clone /<repository-path>/repository/ Trường hợp bạn cần kết nối tới Repository: git remote add origin <git-remote-url> tạo một nhánh mới và đặt tên là "feature_x" và chuyển qua nhánh đó (từ master) bằng cách git checkout -b feature_x Trở lại nhánh master git checkout master và xóa nhánh feature_x đó lần nửa git branch -d feature_x Commit và push code mới lên git init git add . git commit -m "Initial commit" git remote add origin https://YOURPROJECT.visualstudio.com/_git/ git push -u origin --all

Thay đổi URI (URL) cho remote GIT repository

Dự án của bạn cần thay đổi repository, chuyển từ GitHub sang VisualStudio hay Bitbucket. Bạn không muốn phải pull source về từ đầu. Bạn có thể làm theo cách sau để sử dụng lại source cũ. git remote -v # View existing remotes # origin https://github.com/user/repo.git (fetch) # origin https://github.com/user/repo.git (push) git remote set-url origin https://github.com/user/repo2.git # Change the 'origin' remote's URL git remote -v # Verify new remote URL # origin https://github.com/user/repo2.git (fetch) # origin https://github.com/user/repo2.git (push) Chúc các bạn thành công!

Gitflow Workflow

The Gitflow Workflow section below is derived from Vincent Driessen at nvie . The Gitflow Workflow defines a strict branching model designed around the project release. While somewhat more complicated than the Feature Branch Workflow , this provides a robust framework for managing larger projects. This workflow doesn’t add any new concepts or commands beyond what’s required for the Feature Branch Workflow. Instead, it assigns very specific roles to different branches and defines how and when they should interact. In addition to feature branches, it uses individual branches for preparing, maintaining, and recording releases. Of course, you also get to leverage all the benefits of the Feature Branch Workflow: pull requests, isolated experiments, and more efficient collaboration.