this post was submitted on 11 Aug 2023
298 points (98.7% liked)

Programming Humor

2676 readers
1 users here now

Related Communities !programmerhumor@lemmy.ml !programmer_humor@programming.dev !programmerhumor@kbin.social !programming_horror@programming.dev

Other Programming Communities !programming@beehaw.org !programming@programming.dev !programming@lemmy.ml !programming@kbin.social !learn_programming@programming.dev !functional_programming@programming.dev !embedded_prog@lemmy.ml

founded 1 year ago
MODERATORS
 

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

you are viewing a single comment's thread
view the rest of the comments
[–] bappity@lemmy.world 2 points 1 year ago (1 children)

the pasted commit will be at the top of the history for branch 2

[–] BradleyUffner@lemmy.world 1 points 1 year ago (1 children)

That seems like it would cause chaos if those branches were ever merged.

[–] akincisor@sh.itjust.works 6 points 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.