reading notes for code fellows
version control systems allow you to revisit previous versions of a file by recording changes, allowing you to revert files, track modifications, and compare changes.
Local Version Control
Centralized Version control
Distributed Version Control
What is Git?
git came from the open source software project Linux kernel. Many of the devs on that project were using a DVCS called BitKeeper until they had a falling out with the company managing it and the chief architect on Linux kernel created Git instead.
git includes GUI tools, but users can add third-party tools as well.
git config allows you to configure your settings the way you like and do things like add your email and name to all commits.
git defaults to the system’s deafult text editor unless you manually change the system default to the editor of your choice.
use git config --list to check your settings
to import an existing project into git
cd into the project directorygit init to make a new .git subdirectorygit commit -m "COMMIT MESSAGE HERE" to create an inital commityou can copy an existing repo using git clone ADDRESS OF REPO and receive all versions of all the project’s files.
the local repo has three components
all files in a working copy of a project are either
after you edit a file it is flagged as modified
you stage the modified file
you commit the staged changes
git status gives you the current state of files
git add FILENAME tracks one file
git add * will track all of them
git commit -m "COMMIT MESSAGE HERE" will record all of your staged files
git commit -a will commit all modifications
git push origin master pushes changes from the local master branch to the remote repo ‘origin’
git stash temporarily hides changes, giving you a clean directory, then they can be retrieved with stash apply
remote repos allow collaboration within teams by letting them clone the repos to their local branch.
git remote shows the short names of all specified remotes locally, while git remote -v shows the URLs by their short names.