February 8, 2025
O. Wolfson
git config --global user.name "Your Name"
, etc.)🔹 Hands-on Exercise: Install and configure Git, set up SSH keys for GitHub.
git init
)git add
, git commit
)git status
, git diff
)git log
, git show
)🔹 Hands-on Exercise: Create a new repo, track changes, and commit with meaningful messages.
git checkout <commit>
(temporary switch)git reset --hard <commit>
(permanently go back)git revert <commit>
(safe rollback without losing history)git reset --soft HEAD~1
(undo last commit but keep changes)git reset --hard HEAD~1
(undo last commit and discard changes)git restore
(discard uncommitted changes safely)git reflog
)🔹 Hands-on Exercise: Simulate accidental deletions and recover using git reflog
.
git branch
, git checkout
, git switch
)git merge
) & Dealing with Merge Conflicts<<<<<<<
, =======
, >>>>>>>
)🔹 Hands-on Exercise: Create feature branches, merge them, and resolve merge conflicts.
git push origin main
)git clone
)git pull
)git fetch
vs. git pull
🔹 Hands-on Exercise: Push a local project to GitHub and collaborate.
🔹 Hands-on Exercise: Fork a repo, make changes, submit a PR, and review another PR.
git stash
) to Temporarily Save Changesgit cherry-pick <commit>
)git rebase -i HEAD~N
)git commit --amend
git push --force
(and how to recover if used wrong)🔹 Hands-on Exercise: Rebase, squash, and cherry-pick commits in a real project.
git blame
to Find Who Changed Whatgit bisect
)git revert
vs. git reset
)git merge --abort
)🔹 Hands-on Exercise: Use git bisect
to track down a bug in a project.
git clone --depth=1
).gitignore
to Improve Speed and Reduce Cluttergit branch -d
& git branch -D
)🔹 Hands-on Exercise: Optimize a bloated Git repo for better performance.
🔹 Hands-on Exercise: Set up a GitHub Actions workflow for automated testing.
🎯 Goal: Apply everything learned in a real-world team setting.
✅ Work on a team project with feature branches
✅ Implement pull requests & code reviews
✅ Resolve conflicts & debug issues
✅ Set up GitHub Actions for automation
✅ Optimize Git history before merging to main
🔹 Hands-on Exercise: Make your first real open-source contribution.
🚀