Bunny

Back to Main

Git Hygiene

As part of your on boarding and setup you should have set up GIT.  Git is a version control program that maintains a history of changes for your work and lets you organize your changes into branches.

This tutorial is going to presume you have read the basics and know how to make a branch, merge a branch, push and pull.

Pull gets the latest changes off the main server.

Push pushes your branch to the main server so other people can check it out. 

If you want to keep your current work files up to date pull to update main and merge main.

Which leads us to lessons 1.

Make a new branch for every project.

Every single task you set out to do, make a single branch for that task.  You can even make branches off of branches so if you want to try multiple ways of doing something you can make multiple branches and try the different ways and keep the one that works.  IF someone pulls and wants to work your changes into the mainline they want to only get that one change and not that half-finished side thing you were doing that was also on the branch.  Compartmentalize.  With that in mind..

Commit early commit often.

A good chain of well describe commits gives a lot of points in time you or someone else can step back along and rewind time to before you made a regrettable decision.  You will thank yourself for sticking too this.  Giving your commits concise descriptions that help you find that point before the regrettable decision will also be nice.

Do not push to main.

The main branch is the stem from which all other projects branch.  You push some dodgy there it can pollute everyone's projects.  There is a place in hell for people who push to main.  Don't go there.

Do not rebase a public branch.

Rebase is an alternative to merging from main.  You can read up on the specifics here. Rebase alters history.  And if you do it on a branch that you have not pushed to the server that's fine and dandy, it can even keep your commit history cleaner if you know what you are doing.  If you push a branch to the server though, and then rebase it, and then someone checks out the branch on the server, you create conflicting realities.  Once you have pushed a branch rebase is off the table.  Do not rebase a public branch.

Back to Main