Is this workflow the same regardless of the project I work on?


#1

Question

Is this Git workflow I just learned the same regardless of the project I’m working on?

Answer

For the most part - yes!

git init:
Unless someone else sets it up for you, you’ll need to initialize your local repository on your computer. Whether you’re initializing a new Git project or are cloning an existing one, you’ll still have to git init a local repo. However, you only need to do this once for any given repo, this is not a step you do after every change.

git add:
After you make your changes, you’ll add them to the staging area if they’re files you want to be tracked with this Git project. This is also a basically universal step in the process.

git commit:
This can be where some differences come in, depending on what you’re working on. Sometimes you may not want to commit what you just did, but rather stash the changes you made for later because they don’t work well with the existing code, or because your project changed directions. Stashing code allows you to access it later, but doesn’t commit it to the local repository.

All of the others, status, diff, and log, are helpful tools that let you check info along the way to stay on track. The main part of the workflow missing now, which you’ll learn about, is git push, where you actually send your local code to the remote repository!