Believe it or not, git checkout

https://lemmy.world/post/3019211

Believe it or not, git checkout - Lemmy.world

> 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

I confess, I use switch now
believe it or not…
And there is also git restore now.
We have the best flows in the world… Because of git checkout
Get something into your work directory? Check it out. It’s not that weird…
only just found out how cherry picking works I love it
Nice, would you explain cherry picking to me, a dummy?
You can take a commit that was pushed in branch 1 and copy it to branch 2

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.

the pasted commit will be at the top of the history for branch 2
That seems like it would cause chaos if those branches were ever merged.

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

Common workflow use of cherry-pick:

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

    Fun fact! If you have to quickly swap between two different branches you should try:

    git checkout -

    It will swap to the previous branch you were on. Have fun!

    git switch - also works for this