7 examples for git checkout

{{ score }}
  # Create and switch to the branch 'foo'
git checkout -b foo
{{ score }}
  # Check out a file from an earlier commit

git checkout c27cbab Gemfile
{{ score }}
  # The following command will create a local branch named foo, tracking the remote branch origin/foo. When you push your
# changes the remote branch will be updated.
git checkout --track origin/foo
{{ score }}
  # Get the foo.py file from origin develop into the current branch.
git checkout origin/develop foo.py
{{ score }}
  # Create a local named `foo` based on `origin/bar`,
# but do not track `origin/bar`.
git checkout --no-track -b foo origin/bar
{{ score }}
  # Go back two versions
git checkout HEAD~2
{{ score }}
  # Selectively checkout part of a file from a different branch
git checkout --patch branch_name -- file_name