BootCamp by Dr.Angela
1. Introduction to Version Control and Git
- Version Control: Tracks changes to files and allows you to roll back to previous versions when needed.
- Git: A distributed version control system widely used for software development.
2. Version Control Using Git and the Command Line
- Git Workflow Working Directory | git add ↓ Staging Area | git commit ↓ Local Repository | git checkout ↓ Working Directory
- Common Commands
- git status : Check the current repository status
- git add : Add a file to the staging area
- git add . : Add all modified files
- git commit -m "message" : Save changes to the local repository
- git diff : Compare changes in the working directory with the last committed version
3. GitHub and Remote Repositories
- Developer Journey : Learn to Code → Attend Events → Participate in Hackathons → Volunteer → Freelance → Apply for Developer Jobs → Internship → Contribute to Open Source → Build and Share Your Own Projects
- Connecting to a Remote Repository : git remote add
- Pushing Changes : git push -u
- Repository Structure Working Directory ↓ Staging Area ↓ Local Repository ↓ Remote Repository (GitHub)
- Useful GitHub Feature
- Insights → Network: Visualize branch and commit history
- Main Branch : The primary branch of a repository (commonly main)
4. .gitignore
- Common Files to Ignore
- macOS : .DS_Store, .DS_Store?, .Trashes, ._*, .Spotlight-V100
- Windows: Thumbs.db, ehthumbs.db
- Creating a .gitignore File : touch .gitignore
- Add files or directories that should not be tracked by Git.
- Refresh Git Tracking : git rm --cached -r .
- Removes all files from Git tracking
- Keeps local files intact
- Commonly used after updating .gitignore
5. Cloning Repositories
- Why Clone? : Build on existing code, Improve your own version, Read other people's code, Contribute to open-source projects
- Clone a Repository : git clone
6. Branching and Merging
- Why Use Branches? : Branches allow feature development without affecting the main codebase.
- Common Commands
- git branch : Create a new branch
- git checkout : Switch to another branch
- git merge : Merge a branch into the current branch
- Practice Tool : https://learngitbranching.js.org/
- Additional Git Commands
- git branch -f main : Force the main branch pointer to another commit
- git revert : Create a new commit that undoes changes (safe for shared repositories)
- git reset : Move the branch pointer (typically used locally)
- git rebase : Reapply commits on top of another branch
- git cherry-pick ... : Apply specific commits
- git tag : Create a tag
- git describe : Show the nearest tag and commit information
- Format : --g
- git fetch : Download remote changes without merging
- git pull : git fetch + git merge
- git push : Upload local commits to a remote repository
7. Forking and Pull Requests
- Open Source Contribution Workflow
- Forking : Create your own copy of another repository on GitHub
- Pull Requests (PRs) : Suggest changes to the original repository, Allow maintainers to review, discuss, and merge contributions
- Typical Contribution Flow : Fork → Clone → Create Branch → Commit Changes → Push → Open Pull Request
Top comments (0)