Before I started using Git as my SCM, I would “throughly” test the code for stability then I’d just copy the working directory and rename it to something like (date)project_name. Then if I messed up somewhere and couldn’t dig myself out I would just start from the last stable directory. Then I heard about Git.
I want to know if I’m using Git correctly so far. This is what I’ve been doing:
-
write some code…
-
git add .to add all the changed files to the stage -
git statusto check if those changed files are ready to be committed -
git committo commit the latest changes and write a commit message -
repeat
So far this is all I’ve been doing. For simple backup purposes and for the ability to revert back to a “previous stability” is this enough knowledge of Git? If not, what else should I know?
If all you want to do is be able to reset to an old commit when something goes wrong, then yes, that’s it. Although you can combine all the git steps into one with:
(which commits all changed tracked files)
I would look into branching and tagging if you have time, but they’re not strictly required for what you’re doing, they just tend to make life easier