Week 4 Summary Task – GitHub Collaboration Simulation - snir1551/DevOps-Linux GitHub Wiki
This repository demonstrates a real-world collaborative Git workflow with a focus on:
- Branching and feature development.
- Conflict simulation and resolution.
- Using
rebase
andcherry-pick
. - Clean commit history and code review.
- Automations: GitHub Actions for linting and logging (permission given through the Settings in github).
gh repo create week4-collaboration --public --source=. --remote=origin --push
# or via GitHub UI
git branch feature-a
git branch feature-b
Edit the same line in a shared file (e.g., main.py) on both feature-a and feature-b.
git checkout feature-a
nano main.py # and write the below, and then alt+o , enter , alt+x
print("Hello from feature-a")
git add main.py
git commit -m "update main.py from feature-a"
git push -u origin feature-a
git checkout feature-b
nano main.py # and write the below, and then alt+o , enter , alt+x
print("Hello from feature-b")
git add main.py
git commit -m "update main.py from feature-b"
git push -u origin feature-b
gh pr create --base main --head feature-a --title "Merge feature-a" --body "Add feature-a changes"
- Snir assigned me as reviewer and used labels for PR.
- PR Approved and merged to main.
git checkout main
git pull
git checkout feature-b
git rebase main
# Resolve conflicts if any, (for example we edited the main.py)
# and then we did `git rebase --continue` to continue.
git push
gh pr create --base main --head feature-b --title "Merge feature-b" --body "Add feature-b changes"
Assigned Snir as reviewer and used labels for PR.
PR Approved and merged to main.
we used cherry-pick to get some 'bug fix' from a branch with multiple commits: git cherry-pick bffbf23
git checkout main
git log --oneline --graph --all # used to see all the commit hash's
git cherry-pick <commit-hash> # git cherry-pick bffbf23
git push
-
What was the most challenging Git concept this week?
- the most challenging concept was understanding the Rebase concept and when its best to use it and how exactly.
-
What did you learn about collaboration?
- we learned that we need to have good communication in order to not cause conflict by working on same files or branchs, and also make the work faster and more efficient by allowing each of the collaborator to work on different feature.
- that we should create issue before creating a pull request.
-
What mistakes did you make and how did you fix them?
-
we didnt pull the recent changes from main before trying to apply changes from new branchs, which made problems
-
we accidently commited and pushed to the wrong branch, and we fixed it by using git reset --hard HEAD~1
-