DEV Community

How I Git

Andy on February 24, 2017

As usual, this post initially appeared here I'll bet you use git (or Subversion or something, but I know git so that's what I'm writing about). ...
Collapse
 
phillijw profile image
Joe Phillips

Gross merge commits out of master? No... those merge commits are telling an important story. It's incredibly easy to hide them if you don't want to see them. When you show the git log, only show the "first parent" and "hide git merges".

I'm not accusing you of not knowing how to git but I often do see people who don't really know what they're doing give advice to the masses and then we end up kind of where we are now... git hell.

Collapse
 
andydangerous profile image
Andy

Thanks for your input, Joe! I'll try to address some of your concerns in the next git post, whenever that comes along.

Collapse
 
zeeeds profile image
Yazeed Sabri

The problem with "first-parent" is that you have to always merge branches into master (i.e never call git merge master). This works great with what the article said about rebasing master onto your branches. I do not get the last point of how git would not create a merge commit if your branch is up to date with master. I know git does this with fast-forward, but do not understand how it would work with a branch that was up to date due to rebasing.

Collapse
 
jacmoe profile image
Jacob Moen

Excellent!

I was about to write that it would be nice to have a link to a rebase explainer, but then I noticed that it is already in your great post, so I squashed rebased my comment :)

Yes, I am a git culprit way too often!

Collapse
 
lawley profile image
Michael Lawley

Interesting. How do you reconcile pushing branches for CI builds with rebasing?

Collapse
 
andydangerous profile image
Andy

Great question. I don't actually have a good answer here. In practice, I am usually comfortable force-pushing to non-master branches. One solution could be using more ephemeral branches for development and being a bit more rigorous with branches for CI?

Collapse
 
adymitruk profile image
Adam Dymitruk 🇨🇦

I disagree with almost everything in this post. Information hiding. rebasing introduces many issues. Use merge reset as your workflow.

Collapse
 
michaeltd profile image
michaeltd

Does backing up your $HOME directory count as a valid use? I've heard of gents silly enough to try it. XD

Collapse
 
nilsonkos profile image
nilson-kos

Thx

Collapse
 
andrespineros profile image
Andrés Felipe Piñeros • Edited

Amazing article. I have been using git for a long time, but I just "survive" while using it. This opened up a whole new world.

Collapse
 
dimpiax profile image
Dmytro Pylypenko

Good article, thanks for experience sharing :)