Source Control - Git Intro Flashcards
Keywords: Version Control
AKA source control, the practice of tracking and managing changes to software-code.
version control tools help software teams manage changes to source code over time.
Keywords: Git
Distributed Version control system that tracks changes in any set of computer files, usually for coordinating work among programmers collaboratively developing source code during software development. meant to amp speed, data integrity, and support for distributed, non-linear workflows.
open source version control system
Keywords: Repository
tracks and saves the history of all changes made to the files in a Git project.
Collection of files of various different versions of a Project
The repository is the .git hidden folder inside the workind directory. the working directory is essentially your project folder.
Keywords: 4. Git HEAD
“active” or “current” branch. only one branch can be checked out at a time - at said time, called the HEAD branch.
Keywords: 5. Working directory
The Workind Directory is a single checkout of one version of the project.
This means if you checkout a branch and are sat on a commit, your working directory is the “umbrella” term for all your files and folders.
“all your files and folders”. contains the .git file (repository)
Keywords 6. Staging Area
If the working area is where files are not handled by git, then Staging Area is files that are going to be part of the next commit, which lets git know what changes in the file are going to occur for the next commit.
Keywords: 7. Commit Object
a snapshot is a commit.
A commit object includes a pointer to the main tree (root directory) as well as other meta-data such as the commiter, a commit message and the commit time.that represents a snapshot of the contents of the working directory at a certian point)
The commit object stores the hash of the tree object (
Keywords: 8. Branching
Git Branches are a pointer to a snapshot of your changes.
When you want to add a new feature or fix a bug you spawn a new branch to encapsulate your changes. The branches can be merged back into the main/master branch when ready.
Commands 1: init
Create empty Git repo in specified directory. Run with no arguments to initialize the cuurrent directory as a git directory.
git init <directory></directory>
Commands 2: add
git add <directory></directory>
Stage all changes in <directory> for the next commit. replace <directory> with a <file> to change a specific file.</file></directory></directory>
Commands 3: commit (-m)
git commit -m “<message>"</message>
Commit the staged snapshot, but instead of launching a text editor, use <message> as the commit message</message>
Commands 4. status
git status
List which files are staged, unstaged, and untracked.
Commands 5: diff
git diff HEAD
git diff –cached
Show differences between <working>/<staged> and last commit.</staged></working>
Commands 6: mv
git mv [<options>] <source></source>... <destination></destination></options>
Move or rename a file, directory or symlink
-f force
-k skip move or rename actions that cause errors
-n do nothing
-v verbose (report file names as they move
Commands 7: rm
remove files from the working tree and from the index.
Commands 8: log
git log
show the commit history for the currently active branch.
(only current branch)