Git Rebase VS Git Merge

Git Rebase VS Git Merge

Okay, first off, this isn’t going to be a detailed explanation on the eccentricities of git, git rebase and git merge. If you want, that there’s some internets for you to use. (This explanation is pretty good). It’s going to be my thoughts and experience with them.

Git Merge

I’m most familiar with git merge. You switch from your branch over to master, pull down master, switch back over to your branch, merge master in, fix any conflicts, switch back over to master and merge your branch in. The handy thing about git merge is that what you’ve done on your branch doesn’t get overwritten by master. When you do your merges though, you’re going to get all the revision histories for the branches. So if you’re working with a master branch that has a lot of contributors, then your history is going to look a bit messier.

Git Rebase

Rebasing gives you a cleaner revision history. Everything is pretty and linear and your git log will be prettier too. Super cute and fun. However, you’re going to have not as much fun when it comes to conflicts or someone’s been editing the same files you’ve been editing. I’ve had issues where what I’ve written on my local branch was overwritten and it was such a pain to fix and keep track of everything. You can fix all this, but it’s just more of a hassle to resolve, and I’ve gotten into these seemingly unending loops of resolving conflicts for each commit. You can also rebase more frequently which helps.

So which is better? Neither one is better, they serve their own purposes and they both have uses and how you want to use them is up to you. Any thoughts? What do you use most often?

More next time!

-Rachel

A Super Easy Way to Get Git Autocomplete Working on a Mac

A Super Easy Way to Get Git Autocomplete Working on a Mac

So I’ve just recently transitioned over from using a PC to using a mac for development. (I like developing on a mac a lot better) One of the first things I noticed though, was that git wasn’t autocompleting for me when I was working locally. I’m used to just ssh-ing in to servers and git just always would autocomplete. Not so with iTerm, so I went to the internet to find out how to fix this.

I found a couple of posts on Stack Overflow, outlining how to use brew and git bash-completion and tried those out with no success. I did learn about .zshrc and .bashrc and some other config files, so it wasn’t a complete loss.

In the end, I got a tip to try Oh My Zsh. I installed it via curl as directed on their homepage and there you go. I could tab out all my git commands without having to edit bash_completion.d or any other file. There’s lots of plugins you can install and git came installed by default.

If I wanted to add more plugins, I’d just edit my ~/.zshrc file and add them as plugins. Super fast and super easy.

Look how pretty and useful!

I will say that if you want to also install the Docker plugin, there’s currently a bug with installing that one. To get that to work remove the zcompdump file in your home directory and then restart iTerm.

rm ~/.zcompdump-[DEVICE NAME]-[Numbers]

-Rachel