Hello Community,
I have a concern about the git commit. I don't know if I'm doing it correctly.
When I create HTML webpages, I'm used to committing every time I create a meaningful full small block. For JavaScript, I used to do it line per line.
But things have changed as I was introduced to pseudocode. And I'm confused when I have to commit the creation and "conversion" to JavaScript.
Here is an example of each of the steps I used to create a Rock Paper Scissors game:
STEP 1: Create Big Picture/Main algorithm
What I do is:
1 Create a folder called "algorithm" or "logic" 2 Create a file BIG_PICTURE where I briefly define what my code will do.
-> Big_Picture
Each line I create will be a "sub-algorithm". The Uppercase name at the end represents the name of the sub-algorithm I will work on with pseudocode.
Commit: I commit BIG_PICTURE after I fully create it. Then I commit it with the message "Create BIG_PICTURE basic algorithm"
Questions:
-
Should I rather commit line per line?
-
Is my commit message correct?
STEP 2: Create sub-algorithm
Then I repeat the same process with each sub-algorithm. However, I define in greater detail each step.
-> PLAY_ROUND
Commit: Then when all the algorithm is created, I commit the message "Create PLAY_ROUND basic algorithm"
Questions:
-
Should I rather commit line per line?
-
Is my commit message correct?
Edit algorithm
If I find out that my algorithm/sub-algorithm is wrong (ex: I forgot to create a step). I revise the pseudocode and I change what is needed.
Commit: I commit with the message "Fix PLAY_ROUND algorithm: print 'have a nice day' before if statement in ln 6"
Questions:
-
Is my commit message correct?
-
How can I improve it?
Convert algorithm to code
Once my algorithm is clear, I copy it to app.js as a comment. Then I convert each line of pseudocode to JavaScript code like this:
-> Pseudocode to JavaScript
Because my algorithm was previously defined, I don't feel the need to commit line per line. I rather convert all the pseudocode and commit it once, as I feel more comfortable doing so.
Commit: I commit with the message "Convert PLAY_ROUND algorithm to JavaScript code".
Questions:
-
Should I rather commit line per line?
-
Is my commit message correct?
-
How can I improve the commit message?
Thank you in advance for your feedback 😃