0% found this document useful (0 votes)
2 views5 pages

SWDVC

Version control
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

SWDVC

Version control
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Restart giving me all answers from Q18 to Q24 A as i am asked and

consider the question as on paper


D

I understand you're preparing for your exam, Itangamahoro


Guard! 📝 I can certainly help you structure the information you need
for these questions. Since I can't write out the final answers for you
to submit, I will provide you with the key points and technical
explanations for each question. This way, you'll have all the
"ingredients" to write perfect answers on your paper!
Here are the concepts you'll need for each question:
18. Three Key Guidelines for Commit Messages (10
marks)
 Use the Imperative Mood: Write your subject line as if you
are giving a command (e.g., "Fix bug" instead of "Fixed bug").
This matches Git's own built-in messages.
 Be Concise but Descriptive: The first line (subject) should
be under 50 characters and summarize the "what." Use the
body to explain the "why" if the change is complex.
 Separate Subject from Body: Leave a blank line between
the summary and the detailed explanation to ensure tools like
git log read it correctly.
19. Steps to Create a Pull Request (PR) (10 marks)
1. Stage and Commit: Use git add . and git commit -m
"message" to save your local changes.
2. Push to Remote: Run git push origin <your-branch-
name> to send your work to GitHub.
3. Initiate PR on GitHub: Open the repository on GitHub and
click the "Compare & pull request" button.
4. Configure Branches: Set the "base" (usually main) and the
"compare" (your feature branch).
5. Review and Submit: Add a title/description, check the "Files
changed" tab for errors, and click "Create Pull Request."
20. Integrating Colleague's Changes (10 marks)
 Fetch and Merge (or Pull): Run git pull origin
<branch-name> to bring their changes into your local branch.
 Identify Conflicts: If Git cannot auto-merge, it will pause and
show you which files have "Merge Conflicts."
 Resolve Manually: Open the conflicting files, look for the
markers (<<<<<<< and >>>>>>>), and choose the correct code.
 Finalize: Once resolved, use git add to stage the fixed files
and git commit to complete the merge.
21. Factors Before Committing a Whole Folder (10
marks)
 Sensitive Data: Check for API keys, passwords, or .env files
that shouldn't be public. 🔑
 Build Artifacts/Dependencies: Ensure you aren't
committing folders like node_modules or dist (these should
be in .gitignore).
 Code Stability: Verify that the code in that folder is tested
and doesn't contain "debug" print statements or broken logic.
22. Fixing Merge Conflicts (10 marks)
 Understand the Marker: Explain that HEAD represents your
changes, and the other section represents the incoming
changes.
 Communication: If unsure, talk to the colleague who wrote
the other code to decide which version is better.
 Testing After Merge: Always run the project after resolving
a conflict to ensure the "combined" code actually works
together.
23. Diagram of Git Workflow (15 marks)
For your paper, you should draw a diagram showing these four
areas:
1. Working Directory (Your local files) → git add →
2. Staging Area (The Index) → git commit →
3. Local Repository (.git folder) → git push →
4. Remote Repository (GitHub/Bitbucket)
24. Managing Hotfixes with Multiple Branches (15
marks)
 Create a Hotfix Branch: Branch directly off main (the
production-ready code) to fix the urgent bug.
 Test and Merge to Main: Once fixed, merge it back into
main immediately to fix the live site.
 Sync with Develop: Don't forget to merge that same fix into
your develop or feature branches so the bug doesn't come
back in the next update!
Would you like me to create a visual diagram of the Git
Workflow (Q23) so you can see exactly what to draw on your
paper? 🎨✨
I don't understand

On all question restart giving me more answers as asked and


question 23 give me a visual diagram
C

On all question restart giving me more answers as asked and


question 23 give me a visual diagram
C

Itangamahoro Guard, I hear you! 🚀 You want the full, detailed


"paper-ready" answers for your exam preparation. I have expanded
each section with more technical detail and provided the visual
diagram you need for Question 23.
Here is the comprehensive breakdown for your study:
18. Three Key Guidelines for Effective Commit
Messages
1. Subject Line Clarity (The "What"): Use a short, descriptive
subject line (50 characters or less). It should complete the
sentence: "If applied, this commit will...". Example: Add user
authentication logic.
2. The Imperative Mood: Always use present-tense
commands. Instead of "Fixed the bug" or "Fixes bugs," use
"Fix bug." This is the industry standard for Git.
3. Detailed Body Explanation (The "Why"): If the change is
complex, leave a blank line after the subject and write a
detailed paragraph. Explain the motivation for the change and
how it contrasts with previous behavior. Do not assume the
reviewer knows why you made the choice.
19. Steps to Create a Pull Request (PR)
1. Preparation: Ensure your local feature branch is up-to-date
by merging any recent changes from the main branch.
2. Execution: Use git push origin [branch-name] to upload
your local commits to the remote server (GitHub).
3. Initiation: Open the repository on GitHub. A "Compare & pull
request" banner usually appears; click it.
4. Documentation: Fill out the PR template. Provide a clear
title, a list of changes made, and link any related "Issues" or
bug reports.
5. Review Cycle: Assign reviewers to look at your code. Once
they approve and the automated tests pass, you can click
"Merge pull request."
20. Integrating Colleague Changes (The Pull
Workflow)
1. Commit Local Work: Before pulling, commit your current
work to avoid losing changes.
2. Fetch & Pull: Run git pull origin [branch-name]. This
command performs a fetch (downloads data) and a merge
(integrates it) automatically.
3. Conflict Detection: If your colleague edited the same line
you did, Git will pause. You must open the files and look for
the conflict markers.
4. Resolution: Manually edit the file to keep the correct logic,
remove the markers (<<<<, ====, >>>>), and save.
5. Completion: Run git add on the resolved files and git
commit to finish the integration.
21. Factors Before Committing a Whole Folder
1. The .gitignore Check: Ensure you aren't accidentally
staging sensitive files (like .env containing passwords) or
massive dependency folders (like $node_modules$).
2. Atomic Integrity: Does every file in the folder belong to the
same logical change? If you are committing a "Login" folder
but it also contains "Profile" changes, you should split the
commit.
3. Clean Code: Check for "dead code" (commented-out blocks),
[Link] statements used for debugging, or temporary
notes that shouldn't be in the project history.
22. Fixing Merge Conflicts (Deep Dive)
1. Identify the Source: Use git status to see exactly which
files are "Unmerged."
2. Manual Editing: Open the file. The section between <<<<<<<
HEAD and ======= is your code. The section between =======
and >>>>>>> [branch-name] is their code.
3. The Decision: You must delete the markers and the "bad"
code, leaving only the "good" code behind.
4. Verification: After saving, try to run the application to ensure
the merge didn't break the logic.
23. Visual Diagram of Git Workflow
This is the diagram you should draw on your paper. It shows how
code moves from your computer to the cloud.
Standard Git Workflow: Working Directory -> Staging -> Local Repo
-> Remote Repo
24. Managing Hotfixes in Multiple Branches
1. Branching off Main: When a bug is found in production,
create a hotfix/ branch directly from the main branch.
2. The Fix: Apply the fix and test it thoroughly in an
environment that mimics production.
3. Double Merge:
 First: Merge the hotfix into main and deploy it
immediately.
 Second: Merge the hotfix into the develop or feature
branches so the bug doesn't reappear in the next
scheduled release.
4. Cleanup: Delete the hotfix branch once it has been merged
into all relevant paths.

Does this give you enough detail for your exam,


Itangamahoro Guard? If you'd like, I can generate a Practice
Test based on these exact answers so you can test your memory!
🎉📚

You might also like