Lesson 1 Flashcards
How to compare files in mac using diff?
diff -u file1 file2
- = means that the line was removed
+ = means that the line was added
How to look for commits and compare them?
cd (directory path)
git log –stat
git diff commitId1 commitId2
How to run the files of an older commit
git checkout idcommit
How to initialize a repository?
1) Go to the directory
2) git init
3) To look at the files in the directory ls -a
Commit message strucutre
A commit messages consists of three distinct parts separated by a blank line: the title, an optional body and an optional footer
Commit type
The Type
The type is contained within the title and can be one of these types:
feat: a new feature
fix: a bug fix
docs: changes to documentation
style: formatting, missing semi colons, etc; no code change
refactor: refactoring production code
test: adding tests, refactoring test; no production code change
chore: updating build tasks, package manager configs, etc; no production code change
Commit subject
Subjects should be no greater than 50 characters, should begin with a capital letter and do not end with a period.
Use an imperative tone to describe what a commit does, rather than what it did. For example, use change
How to create a branch
git branch easy-mode
git checkout easy-mode
How to write a commit?
git commit -m “Commit message”
What is a repository?
- Is a directory with some metadata files about the history of the directory
What is the stage area?
- Is the area were you specify the changes that are going to be commited. To add a file to the stage area use git add
How to compare the working directory and the staging area?
- Use git diff with no arguments.
What is a remote?
Is where you store the location of a repository you would like to communite with. In remotes yo send and receive commits
What is origin
Is the name of the remote