-
Notifications
You must be signed in to change notification settings - Fork 2
v5 Week 06: A Deeper Look at Git
Reid Russom edited this page Oct 8, 2024
·
3 revisions
Week | Topic | Learning Objectives | Key Resources |
---|---|---|---|
6 | A Deeper Look at Git | Students will be abel to develop a better understanding of git version control and command usage in the command line. | Week 6 Slides TBD |
- Pointers to a snapshot of changes
- Used to add new features or fix bugs in isolation
- Keeps the main branch free from questionable code
- Lightweight compared to other VCS models
- Represent an independent line of development
- Abstraction for the edit/stage/commit process
- New commits are recorded in the history for the current branch
- Tightly integrated with
git checkout
andgit merge
commands
-
git branch
: List all branches -
git branch <branch>
: Create a new branch -
git branch -d <branch>
: Delete a branch (safe operation) -
git branch -D <branch>
: Force delete a branch (even with unmerged changes) -
git branch -m <branch>
: Rename the current branch -
git branch -a
: List all remote branches
- Branches are pointers to commits
- Creating a branch does not change the repository, only creates a new pointer
- Configure and add a remote repo to the local repo config
- Push a copy of the local branch to the remote repo
- Delete a branch after merging it into the main code base
- Use
-d
flag for safe deletion (prevents deleting unmerged branches) - Use
-D
flag to force delete a branch (be cautious) - To delete a remote branch, use
git push origin --delete <branch>
orgit push origin :<branch>
- Combines multiple sequences of commits into one unified history
- Finds a common base commit between the branches
- Creates a new "merge commit" that combines the changes of each queued merge commit sequence
- Confirm the receiving branch with
git status
andgit checkout
- Fetch the latest remote commits with
git fetch
andgit pull
- Execute
git merge <branch>
to merge<branch>
into the current branch
- Occurs when there is a linear path from the current branch to the target branch
- Git moves the current branch pointer to the target branch tip
- No new commit is created
- Occurs when the branches have diverged
- Uses a dedicated commit to tie together the two histories
- Useful for integrating longer-running features
- Occurs when both branches have changed the same part of the same file
- Git stops before the merge commit and asks for manual resolution
- Conflicts are marked with
<<<<<<<
,=======
, and>>>>>>>
- Resolve conflicts by editing the affected files and staging them with
git add
- Commit the changes to complete the merge
- Intro to algorithms
- Solving problems using algorithms
- Use of algorithms
- Web development
- Mathematics
- Operations Research
- Artificial intelligence
- Data science
- Pseudocode
No coding assignment this week - students are practicing GitHub workflow.
The Intro Guidebook is created by Code the Dream staff and volunteers for Code the Dream volunteers. This is your tool – please feel free to suggest edits or improvements.
Overview of the wiki.
Onboarding guide for new volunteers.
Links to pages for specific assignments, including rubrics, overviews of student content, and mentor-created resources.