Git: Cherry-pick a commit into a branch and resolve a merge conflict

Here’s the merge conflict message our merge master got when she tried to cherry pick my pull request (PR) to version 4.7 of the published OpenShift docs (lines , below).

openshift-cherrypick-robot commented 4 days ago • 
@theythemself: #29573 failed to apply on top of branch "enterprise-4.7":

Applying: [RHDEVDOCS-2614](https://issues.redhat.com/browse/RHDEVDOCS-2614) Define ClusterLogForwarder compatability Matrix
Using index info to reconstruct a base tree...
M	logging/cluster-logging-external.adoc
Falling back to patching base and 3-way merge...
Auto-merging logging/cluster-logging-external.adoc
CONFLICT (content): Merge conflict in logging/cluster-logging-external.adoc
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 [RHDEVDOCS-2614](https://issues.redhat.com/browse/RHDEVDOCS-2614) Define ClusterLogForwarder compatability Matrix
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Here, I start by deleting the enterprise-4.7 branch (line ) because it had a previous unmerged commit sitting at the top of the pile. (In the future, I think I’ll avoid this by creating a working branch off of the enterprise-4.7 branch.)

[memyself@memyself openshift-docs]$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'upstream/master'.

[memyself@memyself openshift-docs]$ git branch -D enterprise-4.7
Deleted branch enterprise-4.7 (was 803d05ddd).

Next, I create a new enterprise-4.7 branch that tracks Red Hat’s upstream repo (line). I don’t track my forked copy of the repo, origin, because it has that previous unmerged commit sitting at the top of the pile. (Again, there are other better ways to deal with that problem, I’m just sharing the one I used here.)

[memyself@memyself openshift-docs]$ git checkout --track upstream/enterprise-4.7
Branch 'enterprise-4.7' set up to track remote branch 'enterprise-4.7' from 'upstream'.
Switched to a new branch 'enterprise-4.7'

I fetch the latest changes from upstream and use status to verify that my branch is up to date.

[memyself@memyself openshift-docs]$ git fetch upstream
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 6 (delta 4), reused 5 (delta 4), pack-reused 0
Unpacking objects: 100% (6/6), 1.22 KiB | 1.22 MiB/s, done.
From github.com:openshift/openshift-docs
   335951a8d..0f6dbceae  enterprise-4.5 -> upstream/enterprise-4.5

[memyself@memyself openshift-docs]$ git status
On branch enterprise-4.7
Your branch is up to date with 'upstream/enterprise-4.7'.

nothing to commit, working tree clean

I go to the pull request with the failed cherry pick and copy the hash of the commit. I always squash commits so each pull request has only one commit.

I cherry pick that commit into the 4.7 branch. The merge conflict on line 5 is expected.

[memyself@memyself openshift-docs]$ git cherry-pick 3cad05d66d11c2d38a08322222f6c9dcbfc839ab
Auto-merging modules/olm-mirroring-package-manifest-catalog.adoc
Auto-merging modules/cluster-logging-deploy-console.adoc
Auto-merging modules/cluster-logging-deploy-cli.adoc
CONFLICT (content): Merge conflict in modules/cluster-logging-deploy-cli.adoc
error: could not apply 3cad05d66... RHDEVDOCS-2589 OpenShift Logging: Update any installation/upgrade specific information to use our new channels.
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'

I check the status.

[memyself@memyself openshift-docs]$ git status
On branch enterprise-4.7
Your branch is up to date with 'upstream/enterprise-4.7'.

You are currently cherry-picking commit 3cad05d66.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   logging/cluster-logging-exported-fields.adoc
	modified:   logging/cluster-logging-upgrading.adoc
	modified:   modules/cluster-logging-configuring-image-about.adoc
	modified:   modules/cluster-logging-deploy-cli.adoc
	modified:   modules/cluster-logging-deploy-console.adoc
	modified:   modules/cluster-logging-eventrouter-deploy.adoc
	modified:   modules/cluster-logging-log-store-status-comp.adoc
	modified:   modules/cluster-logging-updating-logging.adoc
	modified:   modules/cluster-logging-visualizer-kibana.adoc
	modified:   modules/olm-mirroring-package-manifest-catalog.adoc

In Atom editor (not shown here), I inspect the file that contains the conflict, modules/cluster-logging-deploy-cli.adoc. In it, I select the set of changes I want to keep. Then, I stage and commit the changes.

Back on the command line, I complete the cherry pick process.

[memyself@memyself openshift-docs]$ git cherry-pick --continue

I -f force push the changes to 4.7 to origin, which is my fork of the repo.

[memyself@memyself openshift-docs]$ git push -f origin enterprise-4.7
Enumerating objects: 27, done.
Counting objects: 100% (27/27), done.
Delta compression using up to 8 threads
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 1.62 KiB | 1.62 MiB/s, done.
Total 14 (delta 13), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (13/13), completed with 13 local objects.
To github.com:rolfedh/openshift-docs.git
 + 803d05ddd...bcc5f087b enterprise-4.7 -> enterprise-4.7 (forced update)

Finally, on GitHub, in rolfedh/openshift-docs, I create the pull request to merge the commit into openshift:enterprise-4.5 from rolfedh:enterprise-4.5.

I’ll need to repeat this process and come up with a more complete set of screenshots.

Here’s a TLDR version of this blog post: Job aid: Git cherry-pick a commit and manually resolve a conflict
I use this short version to copy/paste commands into my terminal.

WordPress bug with highlighting lines in a code block

I discovered a bug. When you use the highlight lines property for code blocks as shown here…

Here, on the right, you see the “Highlight lines” property.

…the highlighting for the higher line numbers gets confused, as shown with lines 27, 39, 60 in the following screenshot.

Here, you see the highlighting on lines 27, 39, and 60 is wrong.

I’ve reached out to WordPress support and will let you know how it goes. I’ll try to file a bug for this.

[UPDATE] A WordPress happiness engineer created the following issue, which does an excellent job of analyzing and describing the problem: https://github.com/Automattic/wp-calypso/issues/50577

A personal post about my mother’s approaching death

This past month has been a hard one for me. My mother is in hospice care at an assisted-living home.

Along with waves of grief about my mother’s approaching death and guilt for not being a better son, I’ve been struggling with anger at “the system.” The people within this system are kind, ethical, caring, and professional. And yet, time and again, they perform functions that reveal a sort of death industrial complex that is bent on extracting money and minimizing care, even if it shortens your loved one’s life.

I don’t believe in burdening others with my hardships. Instead, I want to give you advice that will hopefully be useful if you find yourself in a similar situation.

  • When your loved ones are dying, and you’re struggling with emotions and making difficult decisions, realize that you don’t have to do it all on your own.
  • To the people around you, admit that you’re struggling. Where appropriate, share your feelings. Otherwise, when you need to be with your feelings, you can excuse yourself from situations.
  • Ask a loved one to help you with the logistical and administrative work; there are forms to sign, phone calls, and purchases such as sending Ensure protein drinks, toothbrushes, hairbrushes, gowns, and multivitamins to an assisted living facility.
  • Know what your parent’s or loved one’s rights are or ask the person helping you to know what’s covered and what isn’t by the insurer, medicare, and Medicaid. This information is critical for getting care, medications, and coverage.
  • Don’t sign or agree to anything upfront or verbally. Always require documents and ask for a day to review them before you answer or make a decision.

Update, 4/2/21: I’ve striken some words, above, that I think were too specific to the time and situation when I wrote them. I was upset by some issues with my mother’s care at that time and that statement was too general. I have very positive feelings about the nursing home where she is presently and the hospice care provider that’s looking after her.

That might not be the right question | Seth’s Blog

“Where do you get your ideas?” The thing is, everyone has ideas. All the time, every day. Having ideas is part of the human condition. The right questions might be: Are you exposing yourself to new inputs and new situations, and challenging yourself to find more interesting ideas? Are you pushing the ideas you have further, making them more complete, turning them from hunches to notions to ideas to theories? Are you publishing your theories, sharing your reasoning and having your ideas collide with the real world in service of making things better?

That might not be the right question | Seth’s Blog

Let Gmail to sort your email

Gmail does a pretty good job of categorizing your messages. You can train it to do better.

animation of user moving email to correct tab in gmail
Drag the conversation to the correct tab and click Yes. Google confirms that it will do this for you in the future.

Primary tab

Move messages that you must review, respond to, or take action upon to the Primary tab.

Social tab

  • Move social network notifications to the Social tab.
  • These messages duplicate information in your social networks.
  • You should be able to select and delete everything in this tab without missing it.
  • For example, notifications from Facebook, Instagram, YouTube, TikTok, WordPress, etc.

Promotions tab

  • Move business offers and informational newsletters to the Promotions tab.
  • These messages promote products, services, people, and ideas you like but can safely ignore.
  • You should be able to select and delete everything in this tab without missing it.
  • For example, messages from Medium, Substack, Seth Godin, Walgreens, and Pocket.

Updates tab

  • Move important messages that you should see but usually do not need to act upon to the Updates tab.
  • These include automated automated paystub/billing/account/renewal notifications.

Forums tab

  • Move messages from message boards and mailing lists to the Forums tab.
  • You should be able to individually review and delete most of these messages.

Routinely unsubscribe from notifications and newsletters you don’t read. Some senders let you cut the frequency from daily to weekly or monthly.

Just as wild animals follow patterns that allow them to find adequate nutrition with the minimum expenditure of calories, information seekers follow patterns that allow them to find adequate information with the minimum expenditure of mental energy.

Mark baker, Every Page is Page One

How to learned to love my email inbox

Stop using your email as a holding pen for I should do’s and somedays.

Me, thinking to myself 🙂

My email inbox was a bottomless pile of messages seen and considered but not resolved. Having so many small choices increased my stress and reduced my ability to get things done.

Then, about a month or so ago, I heard “inbox zero” mentioned. I intuitively grasped the concept and set about finding a better way to process my email that reduces my effort, stress, and mess. It’s most obvious feature is that you have zero emails in you inbox.

Now (Feb 20th) I’ve been doing this for over a month and have gotten faster and better at it. Here’s my updated system, which I call zero inbox.

Before you practice zero inbox, train Gmail to sort your messages.

  • Scan and delete the messages that don’t matter.
    • In Gmail, this includes everything in your Social and Promotions tabs.
  • Scan and read the messages that matter. Do the following and then archive these.
    • Respond briefly, if needed
    • Forward messages that require attention or action from others. Include a note saying what you want them to notice or do.
    • If writing this note takes more than a few minutes, schedule a 10-minute videoconference or call with them.
    • Make to-do tasks from messages require further action. (Don’t let yourself start working on this things now.)

When you’re done every message should be deleted or archive. Your inbox should be empty.

It helps to know what your focus/responsibilities/goals/interests are. Don’t waste time on messages that fall outside of these. Don’t get sucked into email threads that don’t concern you or your work.

Conquering my to-do list

Recently, I explained how I implemented zero inbox and started capturing tasks in todoist. By pushing all of my tasks to one place, I cut down on the burden context-switching.

However, this new approach has created a new problem: a ballooning to-do list. Now, I must find a better way manage these tasks.

Fortunately, this article in the Harvard Business Review reminded me of the classic Eisenhower/Covey matrix for prioritizing tasks.

More urgentLess Urgent
More importantDo it nowSchedule it soon
Less importantDivide & conquer, or delegateDelete it, say “No,” or toss
it in the “someday” folder
My adaptation of the task prioritization matrix from Eisenhower, Covey, and the HBR article.

I’ll let you know how it goes.