Git reset + cherry-pick

Just a git technique that is sometimes useful. Mostly when the starting branch changes a lot, due to for example a rebase, but can be other reasons too.

You should start with a git fetch , just to have up to date origin/*.

After this, or before, you need to collect the list of commit hashes that contain the changes you made in your branch. Here’s an example.

In this case, branch RNL-4106 added 2 commits on top of RNL-4048. We ignore the merge commit – hopefully it did not have any actual changes and was a straight merge.

Then with those commit hashes obtained, we can reset the branch to the current state of the source branch with git reset --hard origin/RNL-4048 , then add back the 2 commits with git cherry-pick 36b98cae2cb970c19713cc9900f03114fa4d25a4 5687fb0366dfef9676622e99da266f77818745a1 ( note that it is in the chronological order in which the commits themselves were made )

There may be conflicts, and you’d have to resolve them for each cherry-picked commit at a time. Once you have resolved one commit’s conflicts, you run git add . && git cherry-pick --continue.

After all the commits have been cherry-picked, you run git push -f because you’ve “re-written git history”, and that requires a force push.

Hope That Helps!

Docker + VS Code

It was pretty easy to set up a docker workstation that resembles the kind of env I use for node dev. I just needed to make a Dockerfile like this:

FROM ubuntu:latest
# I don't remember why I needed to set up timezone, TBH . I probably just Googled it somewhere after some warning during build.
ENV TZ=America/Winnipeg
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# I've just always used aptitude on Ubuntu. ag is just so much better than grep. etc.
RUN apt update && apt install aptitude sudo git silversearcher-ag vim -y
# This creates a new user for me. I prefer working with my own user instead of root.
RUN useradd -rm -d /home/username -s /bin/bash -g root -G sudo -u 1000 username
RUN echo 'username:password' | chpasswd

Build the image

From there you build the image with docker build -t dannyb/my-dev . inside the dir with the Dockerfile. This takes a few minutes.

Start the instance

Run docker run -d dannyb/my-dev to start the instance. Now it’s ready to be connected to with VS Code.

Connecting with VS Code

For VS Code setup, I followed these instructions. Now I just open up VS code, press ctrl-shift-P and select the Remote-Containers: Attach to Running Container... option. In the box that opens it will have all your running containers listed, along with the image they were created from. Select the one that says dannyb/my-dev and it basically mounts it. Open up the terminal and you’re logged in as root into the docker instance! The first thing I run there is su username to switch to my user, and cd to go to the user’s home dir.

Setting up SSH key to be able to clone repos

You might well know how this is done. I tend to run ssh-keygen, then cat ~/.ssh/ to copy my pub key. Then you add it to GitHub or Bitbucket or wherever the repo you’re gonna work is.

After this is done, you can clone the repo. Once you’ve cloned the repo, press the “Open Folder” button in the Explorer sidebar of VS Code, and select the cloned repo dir. This actually restarts your terminal session, so just run su username again to switch to your user.

Installing node

I tend to do this with nvm. The installation instructions are pretty short. You can then install whatever version of node you need.

That’s pretty much it

There are any number of other things I end up setting up, specific to my likes and needs of the project.

Farm At Hand Chapter

Ended Googling my name looking for something else funny, but found this little gem I wanted to preserve in case it gets removed at some point…

Super dry and all business…from a FAH team blog post.

What’s your name? My Name is Dan Bernardić.

I’ve been a Web developer since… 2007

How did you become a Web developer? I completed a Bachelor of Science degree in Applied Computer Science from the University of Winnipeg. Since then, I’ve been working on developing my skill set and self-teaching at home and at work.

Where are you located? I work in the FarmLink office in Winnipeg’s Grain Exchange District. I’ve been living in Winnipeg since 2001, when I immigrated from Croatia.

What do you do at Farm At Hand? I work with the development team to create new functionality in the Farm At Hand web app.

I’ve been in the farmily since… FarmLink and Farm At Hand merged in January 2016.

What’s your experience with farming or agriculture? I’ve been working as a programmer in the Agriculture industry since 2013. First I was part of the Farm Business Communications team ( Western Producer, Manitoba Co-operator, Country Guide, etc. ). Additionally, I have about 2 years experience with FarmLink Marketing Solutions and Farm At Hand. I do not have farming experience otherwise.

What is the biggest thing you’ve learned about farmers and/or Agriculture since you joined Farm At Hand? Agriculture is the backbone of industry on the Prairies. Coming to Winnipeg as an adult immigrant, I only recently noticed that Winnipeg probably wouldn’t exist if it weren’t for Agriculture.

What’s one of your favourite moments? Farm At Hand is headquartered in Vancouver. I have not been many places outside of Manitoba, so I enjoyed visiting there when I first joined the team. Their weather is much more mild than in Winnipeg. It was great meeting the team, and I enjoyed talking about programming over fancy burgers and beer.

Today’s Job Search Efforts

I still plan to try to set up my computer further for work on WordPress websites, an initiative I’m hoping will provide lucrative self-employment opportunities, and perhaps even a product with passive income opportunities.