Udacity lesson 4 Flashcards
add files from the working directory to the staging index
git add file_name file_name
can add more and more file names
or just . to add all the available changes
take files from the staging index and save them in the repository
git commit
see changes that have been made but haven’t been committed, yet
git diff
remove a staged commit from the staging area
git rm –cached file_name
how often should I make commits?
when you’ve modified “one thing”.
think: “What if all changes introduced in this commit were erased?”. If a commit were erased, it should only remove one thing.
if you have to use “and”, your commit message is probably doing too many changes - break the changes into separate commits
create an empty file on the command line
touch name.extension
also works in Git Bash
add text to file on the command line
echo “text” > > filename.extension
how to let git ignore a file in the project’s folder, so that it doesn’t commit this file?
create .gitignore, add the name of the file to it
how to let git ignore multiple files in the project?
add some shortened expression for all of the files into the .gitignore. rules below
if all of the 50 images are JPEG images in the “samples” folder, we could add the following line to .gitignore to have Git ignore all 50 images:
samples/*.jpg