Halloo welcome to my article day two of git and github l will take you step-by-step of how to use git and github with your source-code editor.
1.đForking
Repository is like cloning someone elseâs project into your own GitHub account. Forking gave me the freedom to experiment with changes without affecting the original code.
Steps:
1.Navigate to the repository you want to fork on GitHub.
2.Click the âForkâ button (usually top-right).
3.Choose your GitHub account as the destination.
GitHub creates a copy in your accountâready to work on!
After that, you can clone the forked repo;
`git clone https://github.com/your-username/repo-name.git
cd repo-name`
2.đ¤Collaboration
This a key theme in my learning. through GitHub, I realized that coding doesnât have to be a solitary journey. I paired with peers, contributed to projects, and received feedback that shaped me into a better developer.
Steps:
1.Fork or clone a shared repository.
2.Create a new branch for your feature or fix.
3.Make changes and commit them.
4.Push the branch and open a pull request.
5.Discuss, review, and iterate on code with your team.
this are Common commands l used when working with others:
git checkout -b feature-branch # Create a new branch for your work
git add . # Stage your changes
git commit -m "Your message" # Save your changes
git push origin feature-branch # Share your changes
3.đPull Requests
This pull requests are form of access other work but I learned that a PR is just a way of proposing changes. After pushing my changes to a fork, I could create a PR to suggest them to the original repository. It became a ritual: describe what I did, request reviews.
Steps:
1.Push your branch to your fork or the main repo.
2.Click âCompare & pull requestâ.
3.Add a descriptive title and summary of changes.
4.Assign reviewers (if needed).
5.Submit the PR and respond to feedback.
go to your repo and click Compare & pull request.
4.âď¸Merge Conflicts
Merge conflictsâthe unwelcome guests that sneak into collaborative projects. I encountered my first merge conflict while contributing to a project under active development.
Steps:
1.Attempt to merge the conflicting branches.
2.Git will highlight conflicting files.
3.Open the files and look for conflict markers (<<<<<<<, =======, >>>>>>>).
4.Edit the file to keep the desired changes.
5.Save, add (git add), and commit the resolved version.
6.Complete the merge.
Useful commands when dealing with conflicts;
git pull origin main # Sync your branch with main
# Resolve conflicts manually in code
git add conflicted-file.js # Mark conflict as resolved
git commit # Save the merge resolution
5.đ§Code Review
Through code reviews, I gained valuable insights into best practices, efficient design patterns, and bug-spotting skills. Both giving and receiving reviews helped sharpen my critical thinking. I learned to suggest improvements constructively and express gratitude for feedback I received.
Steps:
1.Review the pull request changes on GitHub.
2.Add inline comments, suggestions, or questions.
3.Approve or request changes.
4.Repeat until the code is ready to merge.
5.Merge the pull request when approved.
6.đGitHub Issues
GitHub Issues taught me project planning. I used them to track bugs, brainstorm features, and break down tasks. Opening a good issue involves clear descriptions, reproducible steps (if it's a bug), and appropriate tagging.
Steps:
1.Navigate to the âIssuesâ tab of a repository.
2.Click âNew Issueâ.
3.Add a clear title and detailed description.
4.Label, assign, or link the issue if needed.
5.Submit the issue and update it with progress or comments.
7.đťGit Commands
From git clone and git commit to git rebase and git stash, the command line became my daily companion. While tools like GitHub Desktop exist, mastering the terminal gave me confidence and deeper understanding. Cheat sheets helped, but consistent practice was the real game-changer.
Steps (basic workflow):
git clone â Copy a repo.
git checkout -b feature-name â Create and switch to a new branch.
git add . â Stage changes.
git commit -m "Describe changes" â Save changes locally.
git pull origin main â Sync with the latest changes.
git push origin feature-name â Push your work to GitHub.
in command bash;
git init # Initialize a new Git repo
git clone repo-url # Copy a repo to your local machine
git status # Check your current changes
git add filename # Stage changes
git commit -m "Message" # Save the staged changes
git push origin branch-name # Push to GitHub
git pull origin branch-name # Get latest updates
8.âď¸Pushing Changes to GitHub
Git push origin branch-nameâthe command I now type like muscle memory. Pushing changes is the final stage of my coding cycle. I learned to commit often, write meaningful messages, and push regularly to avoid losing work.
Steps:
1.Confirm changes are committed with git commit.
2.Use git push origin to push.
3.Visit your GitHub repo to see your updates.
the command bash
git add . # Stage all changes
git commit -m "Descriptive message"
git push origin your-branch-name # Upload to GitHub
Learning Git and GitHub transformed my development workflow. The lessons werenât always easyâIâve broken things, lost commits, and puzzled over conflicts. But every bump in the road sharpened my skills.
If you're just starting, take it one concept at a time. Don't fear mistakesâthey're the best teachers.
happy coding đ
Top comments (0)