liveBook · Manning

Checkout

As explained in Software Engineering for Data Scientists

git checkout is a Git command that switches working-tree content or selects versions of files and branches.

Use `git checkout` to switch the active working branch, so new commits affect that branch rather than `main`. It can also resolve a conflict by selecting a remote version of a file. section 2.5.1 section 2.4.2

Common uses include:

  • Switch to an existing branch with `git checkout rules_based_model`. section 2.5.1
  • Return to the main branch with `git checkout main`. section 2.5.1
  • Keep a remote version during a conflict with `git checkout --theirs 1_process_data.py`. section 2.4.2

Developing a rules-based model

Create `rules_based_model`, switch to it, and commit model changes there. Checking the branch list shows an asterisk beside `rules_based_model`; switching back to `main` allows the branch to be merged. section 2.5.1

Listing 2.27 git checkout [different branch] will switch to a different branch so any commits you make will be made to this branch
git checkout rules_based_model  #1

See the exact command for switching from the current branch to `rules_based_model`. section 2.5.1

How Software Engineering for Data Scientists covers it

How deep it goes
Explains branch switching, active-branch effects, and one conflict shortcut, without detailing broader checkout modes.
Examples
Demonstrates `rules_based_model`, `main`, and `1_process_data.py` as branch and conflict examples.
What it assumes
Assumes familiarity with Git repositories, branches, commits, and remote-versus-local changes.
What you can do after
Apply it via Git to switch branches, isolate commits, return to main, or retain a remote conflict version.
How it connects
Connects branches with commits, remote repositories, merge operations, and conflict resolution.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Engineering for Data Scientists. The section links point to the parts of the book it draws on.