This is the Hello World example from the git project. (Changed in the original and pushed to shared)
This project is a comprehensive dive into Git version control. It covers repository initialization, history management, tagging, branching, and advanced history manipulation through rebasing.
- Initialized the repository in the
hellodirectory. - Created
hello.shand evolved it from a simple echo to a script that accepts arguments and has default values. - Practiced granular commits by splitting comment changes and logic changes into separate commits.
- Used
git log --onelineandgit log --graphto monitor the project tree. - Successfully navigated history using
git checkoutwith tags and parent references (v1^).
- Created a
greetbranch for a major rewrite of the "Hello World" functionality. - Moved
hello.shinto alib/directory usinggit mvand implemented aMakefileto handle the execution logic. - Created
greeter.shto demonstrate function sourcing and modularity.
| Challenge | Solution | Lesson Learned |
|---|---|---|
| Missing Author Email | I forgot to set user.email at the start. I used an interactive rebase: git rebase -i --root --exec "git commit --amend --reset-author --no-edit" to fix the whole history. |
Setting up global config (user.name and user.email) is the most important first step in any Git project. |
| Ambiguous Git Push Error | Received a "fatal: ambiguous argument" error during a force push after rebasing. | I verified the push status with git log and origin/main to ensure the remote was updated despite the warning. |
| Detached HEAD State | When checking out tags, I entered a detached HEAD state. | I learned to use git checkout main to safely return to the active branch tip. |
- Personalized Log:
git log --pretty=format:"%h %ad | %s%d [%an]" --date=short - Tagging:
git tag v1andgit tag v1-beta v1^ - Rebase:
git rebase -i --root - Automation:
make run(via the created Makefile)
This project reinforced the importance of a clean, linear commit history. By using rebasing instead of just creating "fix-up" commits, the final audit trail remains professional and easy to follow for any auditor.