-
Git has a special label called HEAD, it basically means "You Are Here"
-
Git: version control system
-
Github: commericial service for hosting the data
-
to do it without VSCode:
- Create a repository online
- click on the top right "Clone" and choose the HTTPS (cuz it's easier)
- create/go to the local directory you want the repository to live in
- git clone
- Bada-bing! This is now sitting on your local computer
- also worth noting, you can use github cli (gh is git's own terminal)
- gh is worth understanding more
-
Add
- The "add" step allows you to stage changes made to your files and prepare them for a commit. You can use the git add command to add specific files or directories to the staging area. For example,
git add file1.txt
orgit add .
to add all modified files.
- The "add" step allows you to stage changes made to your files and prepare them for a commit. You can use the git add command to add specific files or directories to the staging area. For example,
-
Commit
- The "commit" step creates a snapshot of the changes you have staged in the previous "add" step. It records a new version of your project's history with a commit message explaining the changes made. You can use the git commit command along with the -m option to include a commit message. For example,
git commit -m "Add feature XYZ"
.
- The "commit" step creates a snapshot of the changes you have staged in the previous "add" step. It records a new version of your project's history with a commit message explaining the changes made. You can use the git commit command along with the -m option to include a commit message. For example,
-
Push
- The "push" step involves sending your committed changes from your local repository to a remote repository (GitHub). It makes your changes visible to others and updates the remote repository with your latest commits.
git push origin main
to push your changes to the "main" branch of the remote repository named "origin".
- The "push" step involves sending your committed changes from your local repository to a remote repository (GitHub). It makes your changes visible to others and updates the remote repository with your latest commits.
git add <file>
git commit -m "message for why we're staging the files"
git push origin main
git status
// shows what files are staged/modified/etc, use whenever
- What is Version Control?
- keeps track of multiple files across a diverse set of directories and different coders
- without version control distributed teams would be overwriting
- What is cloning in Git?
- Copies a cloud instance to a local computer
- it can be done in a variety of ways
- it does not imply continuous sync - it's a one time thing
- What is the command to track and stage files?
git add <file(s)>
- What is the command to take a snapshot of your changed files?
git commit
- What is the command to send your changed files to Github?
git push origin main