Want to make a branch ?

git checkout

Want to make switch branches ?

git checkout

Want to get a specific file version ?

git checkout

Want to get remove changes to one file ?

Believe it or not, also git checkout

    • richard_wagner@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 year ago

      Thanks. I wonder what effect that has on the git history of branch 2?

      For some reason I thought cherry picking might be the ability to take any file from any commit on any branch and copying it to the current branch.

          • Ugly Bob@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 year ago

            Git’s smart enough to realize it’s the same commit and skip it.

            Common workflow use of cherry-pick:

            1. Say you have a master branch and a release branch
            2. You have a bug in production (off your release branch)
            3. You have other changes in master that are not ready for release
            4. You make a commit to fix the bug and merge to master, run CI and verify it’s fixed
            5. Cherry pick the change to the release branch and release as normal
            6. Merge with master before next release to make sure you can cut a new release

            All this works without issue.