Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Podia.

Basic workflow for Git

Details

Here’s a basic Git workflow you can use to practice staging files and making commits. Please note that this workflow isn’t recommended for major projects–it’s only intended to help you get more familiar with commits and staging for personal projects.

Setup

The last two steps in the setup can be flipped if you prefer to initialize the repo first.

Workflow

The reason why you shouldn’t use this workflow for major projects is that it only relies on one branch–the master branch. Many resources (and other developers) will tell you not to commit directly to master. The idea is that the code on the master branch should be production ready (meaning it should be free of major bugs), so you should do your development on a separate branch and then merge into master when your code is ready for production. Also, if you make any mistakes on a separate branch, you won’t mess up the commit history on the master branch. Many developers prefer to have a clean commit history.

You’ll learn more about branching in the next lessons.

Exercises

There are no exercises for this lesson.

References

Recording Changes to the Repository from the Pro Git book

Back to: Git Reference > Git Basic Workflow