Skip to content

Blog Post: Developing good habits by not committing code to your main branch. #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions _posts/blog/2022-03-29-dont-merge-master.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: "Developing Good Habits: Don't Commit Directly To Your Main Branch"
author: chipoglesby
comments: true
date: "2022-03-29"
layout: post
slug: dont-commit-to-your-main-branch
excerpt: You should treat each of your Github projects like you're working on a team.
published: false
categories:
- sidenote
---

I had a epiphany recently that I should start doing all of my documentation work in Markdown and
Git; instead of doing some in Google Docs, some in Confluence and some in plain-text files.

As I started researching if other people were doing this I came across all different types of
stuff. There were software programs and many blog posts calling for the same type of thing!

"This is great" I thought to myself as I read all of this. It felt like some type of validation
because I wasn't crazy for trying this and I wasn't alone.

Then I came across an author who shared a lot of the same opinions I have on using Markdown
and in one of their posts they suggested "just commit your work straight to your main branch."

This got me thinking about how although this is "OKAY" to do, it shouldn't be your best practice.
Getting into a habit of commit all of your work to a main branch, isn't just lazy, it's
also dangerous if you were to ever work in a development role that builds code.

It reminds me of this meme I've seen before:

**_"So you're not really supposed to do this, but this is what we do."_** -- Don't be that person.

![](https://storage.googleapis.com/www.chipoglesby.com/wrong.jpg)

Ideally, if you're working by yourself or with more than one person, you will be creating
branches to work on and then merging them into your main branch.

This isn't a hard and fast rule, but it's kind of like driving without wearing your
seatbelt. If you don't, dangerous things can happen.

Sometimes, depending on how I feel when I'm working on a side project, I will use
Issues and pull requests and comments, just like if I were collborating when a coworker
on a project. It's totally overkill when working by yourself, but it's also just good
practice.

For example this (reproducible research template)[https://github.com/chipoglesby/reproducibleResearchTemplate]
that I came up with is a really great way to keep me organized and it lets
others see how I work through a project. Five or six years after I created that,
which OMG is this year!, I should be able to come back and still use it and
produce the same results as when I first created it.

Personally, I feel like developing good habits in the small things helps you
be more successful in the large things. And please, don't get me wrong, I am
nowhere near perfect. There are things that I know I'm suppose to do that I don't
do because I need to cut a corner to make something work quickly or because I forgot
something. I try to make those instances the exception and not the rule.