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


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


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!


Shouldn’t you add files to the staging area before you start modifications? This way you’ll know all your changes are tracked…?


Yes, I would be curious to know the answer to this as well. It makes sense to add the file to the staging area first so that one could see changes being made in the working repository with git diff.

Creating and modifying file-structure is considered a change in the working directory so technically they are correct in the way they phrased it. Either way, yeah you should add the file to the staging area before to make sure you are tracking it in the future.