DEV Community

Long Nguyễn Xuân
Long Nguyễn Xuân

Posted on • Edited on

git switch khác gì git checkout

khi "học git" bạn thường thấy lệnh git checkout ...

nhưng lâu lâu bạn lại thấy cái git switch, vậy nó là cái gì?

à, thì nó là như sau:

  • git switch dùng để "thay đổi branch", thay vì lúc trước mình dùng lệnh git checkout <branch-name>
  • git restore dùng để reset (trả lại trạng thái cũ) của các file về 1 phiên bản (revision) trước đó, giống như git checkout -- <path-to-file>

cái vụ này do lúc xưa, các cụ tác giả của git họ làm cái lệnh git checkout có quá nhiều công dụng đi, khiến cho newbie rối não, nên từ version 2.23 mấy bạn ấy mới bổ sung 2 cái lệnh này cho đỡ rối (hoặc làm rối thêm 🤣 )

nhưng nó chỉ đơn giản vậy thôi.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay