DELAPARRA
Index
Color
NL
Category: Git commands

git checkout

Explained by Updated

What is git checkout?

git checkout: Switch branches or restore specific files from history (legacy command with multiple roles). git checkout is an older command with several jobs. It switches branches, creates new ones with -b, and restores files from another commit, as in git checkout HEAD~1 -- config.php. Because one command did such different things, mistakes were easy. A wrong argument could throw away uncommitted changes in a file instead of switching branches.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about git checkout

What should you keep in mind with git checkout?

Since Git 2.23, the work is split between two clearer commands. git switch changes branches, and git restore restores files. git checkout still works and you will see it in countless tutorials and scripts, so it is worth understanding. For daily work, switch and restore say what they do and are harder to misuse.

At a glance

CategoryGit commands
Explained by
Updated

More Git commands terms

All terms starting with G

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.