GIT — rebase & resolve conflicts

Big Fat Software
2 min readFeb 21, 2021
git checkout master

I did this, so that I can delete my local references to the stable branches

Now, fetch all refs from the remote:

git fetch -a

Now, I’ll delet the local reference to qa (which is my stable branch) so that I can get a clean start:

git branch -D qa
git checkout qa

It should start tracking from origin now.

This is how I do a local copy update without hassle. A git pull origin will create a merge commit, which I don’t like. Any other strategy will occasionally will require me to resolve conflicts. If I’m in-charge of all releases, then, I can’t amuse myself with those. So, I choose whatever makes my life easier.

Now, let’s checkout to our feature branch, and we will rebase it against the stable branch, i.e. qa and since we trust our remote copy more than the local copy, we always do it against origin/qa .

git checkout <feature branch name>
git rebase origin/qa

But if you’ve been following the steps I’ve mentioned previously & understood the notion well, then, you can rebase your feature branch against your local copy as well and that too without problems.

Once the rebase starts, you will occassionally get merge conflicts. They can appear once, or they can appear several times. You’ve to resolve the conflicts in a text editor, manually.

Then do a git statusat the terminal and see the diff. If you notice files, then perform a git add . at the terminal. This should stage all the files containing diffs.

Then, proceed by either choosing git rebase --continue, and this is the most typical case you’d go with. But there’ll be cases where git rebase --skip

will be applicable. Generally speaking, you’ll only have to skip when you see no change after checking the `git status`.

Originally published at http://bigfatsoftwareinc.wordpress.com on February 21, 2021.

--

--