Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Cách sử dụng Git
  6. Cách sử dụng phân nhánh trong Git
  7. Chuyển nhánh
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

Chuyển nhánh

Bạn vừa tạo một nhánh; bây giờ bạn sẽ cần chuyển sang nhánh đó để thêm các cam kết mới vào nhánh đó.

Sử dụng lệnh git checkout để chuyển sang nhánh issue1.

$ git checkout issue1
Switched to branch 'issue1'

Bây giờ, lịch sử trông như thế này:

Current history

Sử dụng tùy chọn -b để tạo một nhánh mới và chuyển sang nhánh đó bằng một lệnh.

Tiếp theo, hãy thêm một cam kết. Thêm phần chữ in đậm bên dưới vào tệp myfile.txt.

Anyone can learn Git with this tutorial and Backlog add: Register a change in an index

Và cam kết thay đổi.

$ git add myfile.txt
$ git commit -m "append description of the add command"
[issue1 b2b23c4] append description of the add command
 1 files changed, 1 insertions(+), 0 deletions(-)

Lịch sử bây giờ trông như thế này:

Current history

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life