Logo

dev-resources.site

for different kinds of informations.

Git Conflict resolution made simple

Published at
7/3/2021
Categories
git
productivity
lifehack
Author
josemunoz
Categories
3 categories in total
git
open
productivity
open
lifehack
open
Author
9 person written this
josemunoz
open
Git Conflict resolution made simple

Have you ever tried to merge a Pull Request and it seems to have a conflict on file that you changed intentionally?

When it comes to conflict resolution, it can be a painful experience sometimes, even when you all you’re doing is accepting the incoming changes.

Git can be intimidating sometimes, and most people tend to prefer a GUI to manage their versioning and source control. But sometimes using the CLI can be the better option.

I’m the kind of weird that likes to do things on the CLI when possible, so I have a small life-hack that has saved me so much time during conflict resolution.

In this example we are going to imagine we are trying to make a PR from development to staging, once you’ve created the PR you notice there is a few conflicts and the PR can’t be merged right away. Don’t panic, we can fix this with the power of the CLI!

Make sure you have the latest version of your destination branch (in this case staging) checked out on your local environment.

Go to your source branch (in this case its development) and run:

git pull origin staging —strategy ours

This will accept the history of the source branch over the destination branch and resolve the conflicting files for you. Now you can safely push the resolution to your remote and the PR you submitted should now be mergeable.

The CLI can be an intimidating place, but sometimes it can be the fastest way to achieve a task. Merge strategies are one of the most powerful options you can use from the git source control system, and there’s many more strategies that allow you to get even more flexibility from these options, I’ll leave a couple of links below where you can learn more about git merge strategies, thanks for reading!

Links:

lifehack Article's
30 articles in total
Favicon
â›”Stop Excessive Validation, you are ruining my life hack!
Favicon
Completed My Blogging Challenge
Favicon
Hacking Watson with Haskell - Part 3
Favicon
Hacking Watson with Haskell - Part 2
Favicon
Hacking Watson with Haskell - Part 1
Favicon
Don’t Panic! The Hitchhiker’s Brew to Serenity
Favicon
Why Multi-tasking is not Good (Bite-size Article)
Favicon
Using Task Management Tools to Forget Tasks (Bite-size Article)
Favicon
Life Hacks: Make the Most of Your Commute (Bite-size Article)
Favicon
On personal goal-setting
Favicon
Power of Logseq - Manage Your Daily Tasks with Outliner
Favicon
How To Customize Your LinkedIn URL in 6 Easy Steps AKA How To Boost Your LinkedIn SEO AKA Lifehacks By Miki Szeles
Favicon
making tough decisions fast
Favicon
Transform any Telegram bot into (almost) an app
Favicon
Why isn't coverage badge in GitLab updating?
Favicon
Code Reactjs Faster by Enabling Emmet for JavaScript and TypeScript in VS Code
Favicon
Automated Form Filling in 4 Steps | No Coding Skills Required
Favicon
A Python package that makes it easier to work with lists on Twitter
Favicon
Git Conflict resolution made simple
Favicon
Finding new music on Spotify by aggregating the choices of tastemakers
Favicon
Transfer files between your phone and computer without any cable and internet!
Favicon
100% Reliability Myth
Favicon
A tip to declutter unused cables with a tape writer and pouches
Favicon
How to get things done in real. A step by step guide.
Favicon
Optimize Your Notetaking With Glyphs
Favicon
Dealing with programmer's burnout
Favicon
Be a good host and share your WiFi
Favicon
Squashing Software Defects with Eisenhower Matrix
Favicon
🗣 Communication Hack – Use Labelled Links
Favicon
Tired of turning Wifi/Bluetooth/Data off in Settings? (iPhone)

Featured ones: